Page 1 of 1

Is there somewhere an event OnApplication load?

Posted: Thu Jun 06, 2013 1:00 am
by andi

I need an event where i can init some local vars.
The problem is that ihave a startpage, and this startpage has to know if it is first timeexecuted or not.
Because the other pages, are going back to this startpage.

But everytime all events are called (OnPageLoad, OnDeviceReady)
Is there an event which is executed only once?


Is there somewhere an event OnApplication load?

Posted: Thu Jun 06, 2013 6:26 am
by Maryna Brodina

Hello! Sorry for late reply. There is no such event. If you don't use full screen refresh while navigating between screens and do not go to any external sites - then Load event for main page would work only one time. If Load event works a few times - looks like you have something from listed above. In this case you would need to change app logic. For example make in localStorage any flag variable and set it to true with other variables. Before you set other variables, check if you've already set flag:
codeif (localStorage.getItem('allSetted') != 'true'') {
//set you variables here
localStorage.setItem('allSetted', true);
}/code


Is there somewhere an event OnApplication load?

Posted: Thu Jun 06, 2013 7:48 am
by andi

Ahhhh yes now it works, it was because i used
Appery.navigateTo('Adressen');
instead of Appery.navigateTo('Adressen', {});