Pass current active page name to JS function

I’m new to fuse so im sorry if I’m asking a dumb question.

Just wondering how can I pass the current active page name (or reference) to a js function. the purpose of this is to be able to dinamically set a variable based on the active page.

Thanks.

The simplest way is to define an Observable string var in JS, and set is as the Active={myVar} of your navigation view. This way, you can switch pages by simply assigning values to myVar.value and also you will have in there the name of the current page. The Active will reffer to the Name of the Page.

Otherwise, if you call your JS method from a trigger within a Page, the context (defined JS vars) of the current page will get passed along automatically.

Check the PageControl on the learn Fuse page.