23 Dec 2010 2:32 AM #1
Go direct to proxy and avoid sync() batching
I am loading about 2MB of JSON data from my server, and then persisting that locally using LocalStorage.
The code is fairly simple. It does an add() on the local store for each record retrieved from the server.
Then I perform a sync().
Since this is a large data set, the actual batch insert operations seem to take up to 30 seconds (however, it's async so I don't see the delay on the application).
What I am finding is that in Safari, the sync() is happening in the background (I know this because the process safari.exe process keeps running until the sync() is complete, which is good). If I kill the safari.exe process, I seem to corrupt my localstorage.
However, I find that with the iPad when the web app is "installed" to the spring board, pressing the Home button seems to kill my process, and will also corrupti my datastore.
In contrast, if I run my app in Safari on the iPad, since the Safari process is always running, I don't seem to hit this issue.
My question: Is there a callback to know when sync() is complete, so at least I can show a progress panel during this 30 seconds?
Or is there a way I can take over and control the proxy to insert non-batched? I'm thinking something like REST, but for localstorage.
23 Dec 2010 1:49 PM #2
26 Dec 2010 10:06 AM #3
Can you please share what you did to save remote JSON to localstorage? using a sample code?
i cant seem to get my head round it as i havent found an examples on this..
By hq242 in forum Sencha Touch 1.x: DiscussionReplies: 0Last Post: 30 Jul 2010, 5:58 AM
By xp743 in forum Ext 3.x: User Extensions and PluginsReplies: 1Last Post: 26 Jul 2010, 11:56 AM
By js_coder in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 25 Jan 2010, 9:10 AM
By krycek in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 19 Dec 2007, 10:23 AM