Function at the page loads

Hi everyone, I’m creating a project with pages that change via a left side menu and I would like a function to run when I load a page because I have to import a series of data from some APIs and store them into a variable to show after this request. However, I need this data on the page init, not globally in the application. I’m using svelte and I’ve tried some method on Page like on:pageInit or on:pageReInit tag but at the init of the page i don’t see in my console the “Hello!” string so I think it doesn’t works.

<Page name={namepage.reference} on:pageReinit={init}>
function init(){
    console.log("Hello!!")
 }