Share code or functions between pages


I need some functions on almost every page like tap functions of my side navigation items. Is there a way to store them in one location instead of writing them in each page’s code behind file?


Why don’t you just write the common function in a separate file and just import it all different files?


Thats the goal. I couldn’t find a guide for it. How exactly do you do that?


I’m not sure what is the challenge here, it’s as simple as,


export function myCommonFunc() {

In controller

export * from "~/common";


<Page loaded="myCommonFunc" ...


But I don’t want my common function to be executed on page load. The page load function does different things on different pages.


That was just an example, you may use it for any purpose.