javascript - How to create one time event when the app opens? -


I'm working on an iPhone app using PhoneGap. When the user opens the app and goes to the main page, I want the database with a live call to synchronize a sync app. This function should be called only once. That is, if the user clicks on the main page again, that function should not be called because it has already been called.

I want to call this function on the OnDeviceReady () function.

  minus on device (if (test.called) {return false;} and {test ();}} function test () {test.called = true;}  

I used the above concept but the function is called again when I click on a different page and then if I click on the main page, that is because this page values ​​the set value false. / P>

Which event should I use to call only once in the app?

I suggest that you use sessionStorage:

Function on Device Repair () {if (sessionStorage.getItem (" isynync ") ===" true ") { Return false;} and {test}; SessionStorage.setItem ("isSync", "true");}}

Unless the browser is open, the session stores the store flag So long as your phonegap app is open.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -