Hi to all
i’m trying to define some page events like “onPageInit”.
I can’t bind events directly on router because doing so means to define all events in a single place (the router file)
I can’t use a global “pageInit” for the same reason: means to define all events in a single function like the following:
app.on('pageInit', function(page) {
if ( page.name == '' ) onHomeInit(page);
if ( page.name == 'order' ) onOrderInit(page);
});
What I would like to do is something like the following (assured that I’m using a different JS file for each page):
app.on('pageInit', 'pageName', function(page) {
my callback
});
with this syntax, I’ll be able to put the same code in every JS file, because only events related to a single page a set.
Any help ?
With F7 v1 there was a similiar way:
App.onPageInit('index', function (page) {
// your code
})
or something similar. It doesn’t work anymore in v2