It’s not currently possible to send functions through the Router. The router can only send serializable values, and functions are not generally serializable (even if they were, the context in which they execute could be entirely different).
“not currently” means you plan to make it possible in the future?
what i try to do (very simplified example):
userPage: (ux+js)
here i have a text that shows the user name + button to edit that name
changeNamePage (ux+js):
displays a page where u can change the user name. If u click ok:
- it changes the display name on "userPage.ux"
- router.back();
if u click cancel:
- router.back();
i would like to be able to send a callback function on the parameters when calling the “changeNamePage”. Of course that page is much more complex and that’s why i would like to have it as a class (and not just a popup).
In this case, “not currently” does not mean we plan to support this. You should not need to pass functions around via the Router
Is the reason you want to pass functions around so that another page that the Navigator instantiates will be able to make modifications to your data context? Perhaps there’s a way to do this where both the code that sends you to the name change page and the name change page itself can both require a module that represents your database/backing store, for example.