+

Improve applicationCache management

Benjamin Renard [2016-09-12 21:18:27]
Improve applicationCache management
Filename
inc/myco.js
diff --git a/inc/myco.js b/inc/myco.js
index dcde4c4..cc0a5e5 100644
--- a/inc/myco.js
+++ b/inc/myco.js
@@ -1082,10 +1082,15 @@ $( document ).ready( function() {
   view_home();
   pleaseWaitHide();

-  $('#update_app').bind('click',updateApp);
-  window.applicationCache.addEventListener('updateready', onUpdateReady);
-  window.applicationCache.addEventListener('noupdate', onNoUpdate);
-  if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
-    onUpdateReady();
+  if (window.applicationCache.status==window.applicationCache.UNCACHED) {
+    $('#update_app').parent().remove();
+  }
+  else {
+    $('#update_app').bind('click',updateApp);
+    window.applicationCache.addEventListener('updateready', onUpdateReady);
+    window.applicationCache.addEventListener('noupdate', onNoUpdate);
+    if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
+      onUpdateReady();
+    }
   }
 } );
ViewGit