Page 1 of 1

Tiggr.persistentStorage example

Posted: Mon Mar 19, 2012 1:04 am
by RyanShay

Can you provide a simple example of how to set a variable via Tiggr.persistentStorage?

Just as a quick test, I'm trying to implement a counter that increases each time the application is run.

var count = parseFloat(Tiggr.getItemFromStorage('count'));
if (isNaN(count)){ count = 0;}
alert(count);
Tiggr.Storage('count',count+1);

I also tried Tiggr.persistentStorage('count',count+1); with no luck either. Hopefully you can point me in the right direction.

Thanks.


Tiggr.persistentStorage example

Posted: Mon Mar 19, 2012 1:05 am
by RyanShay

Also as a note, this is inside of an init function that doesn't get fired until after OnDeviceReady.


Tiggr.persistentStorage example

Posted: Mon Mar 19, 2012 4:25 am
by maxkatz

Just use Local Storage directly.


Tiggr.persistentStorage example

Posted: Mon Mar 19, 2012 4:52 am
by RyanShay

Does local storage persist between application executions? I thought I read in the api docs that it did not.


Tiggr.persistentStorage example

Posted: Mon Mar 19, 2012 5:18 am
by maxkatz

Yes, it will persist.