-
16 Mar 2012 5:06 PM #1
Answered: When will run onUpdated function in app.js?
Answered: When will run onUpdated function in app.js?
Hi, Sencha Touch Team!
I made Sencha Touch 2 MVC WebApp folders and files by Sencha SDK Tools.
I don't understand when onUpdated function in app.js works.
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function() {
window.location.reload();
}
);
}
Thanks.
-
Best Answer Posted by Jacky Nguyen
You should never change the 'id' value in app.json. An in-depth article on how micro-loaders in Touch 2 works is coming soon, so do keep an eye on our blog / newsletter updates.
As a short explanation: 'onUpdated' is triggered after either, or both of the following cases happen:
- Your application's HTML 5 manifest file (cache.manifest) changes. Read more on HTML 5 app cache if you're new to this feature. Since cache.manifest is generated automatically, it contains the checksum values of all managed assets. As you modify the content of index.html file or any other file listed in the 'appCache' config inside app.json, their checksum values change -> the content of cache.manifest changes.
- You have changes in any of your JavaScript or CSS assets listed in the "js" and "css" config inside app.json. Similarly to cache.manifest, when you build your application for production, a production version of app.json is generated automatically. This file contains checksums for all assets. By comparing the latest checksum values with the ones locally stored inside Local Storage, the app knows exactly what file has changed, and pull down the delta for that item, then patch its local copy to make it identical to the latest one.
-
16 Mar 2012 6:14 PM #2Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
- Answers
- 24
It gets called when your local copy of the application has been updated after you deploy the new version on your production server, either via delta updates or HTML 5 manifest update. The web view needs to be reloaded for the user to see the changes taking place, hence the prompt simply notifies and gives the user the option whether or not he/she wants to reload right away, or wait till the next time the app is opened.
Sencha Touch Lead Architect
-
17 Mar 2012 4:24 AM #3
Thank you for your kind reply.
Thank you for your kind reply.
I knew what onUpdated function is for. I'm so interested to find out really, when and how web view(chrom browser) is checking the production server's changes?

Would you elaborate a bit on that? Please ...
Thanks.
-
17 Mar 2012 8:12 AM #4
I got onUpdated function is running
I got onUpdated function is running
Hi, Jacky Nguyen.
I got onUpdated function is running when applicaiton's id is changed.
Am I to understand that application'id include production's version?
for example)
"id": "02da3480-7043-11e1-9b78-0db0d128d299" --> "id":"com.my.app-1.0.0"
Thanks.
-
17 Mar 2012 3:47 PM #5Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
- Answers
- 24
You should never change the 'id' value in app.json. An in-depth article on how micro-loaders in Touch 2 works is coming soon, so do keep an eye on our blog / newsletter updates.
As a short explanation: 'onUpdated' is triggered after either, or both of the following cases happen:
- Your application's HTML 5 manifest file (cache.manifest) changes. Read more on HTML 5 app cache if you're new to this feature. Since cache.manifest is generated automatically, it contains the checksum values of all managed assets. As you modify the content of index.html file or any other file listed in the 'appCache' config inside app.json, their checksum values change -> the content of cache.manifest changes.
- You have changes in any of your JavaScript or CSS assets listed in the "js" and "css" config inside app.json. Similarly to cache.manifest, when you build your application for production, a production version of app.json is generated automatically. This file contains checksums for all assets. By comparing the latest checksum values with the ones locally stored inside Local Storage, the app knows exactly what file has changed, and pull down the delta for that item, then patch its local copy to make it identical to the latest one.Sencha Touch Lead Architect
-
18 Mar 2012 7:34 PM #6
Thank you for your kind reply.
Thank you for your kind reply.
I knew exactly when onUpdated function is triggered, thanks to you.

Have a good day!
-
19 Mar 2012 10:43 AM #7
How does this work, when we have native packing in our app ? the files are running local right ? how does it check it has changes on the server ?
-
15 Mar 2013 9:37 AM #8
I've not seen this dialog pop up in quite a while. Saw it happen once but never again after that. Using the sencha stuff to generate everything.
Edit: sorry it seems my function name became onUpdate instead of onUpdated
-
19 Mar 2013 4:15 PM #9
Is it possible to delay loading the app until the update check is complete? It can be annoying to start working in the app, only to have the update alert appear.
Or alternatively, is there a function/event that gets called when the update check is done, regardless of whether an update is required?
-
16 Apr 2013 11:41 PM #10


Reply With Quote