Permalink
Browse files

comments and readystate checking

  • Loading branch information...
1 parent 01797b5 commit 994d9647454c1f1f43f8256dd5c50b49226e5b04 @coolaj86 committed Aug 2, 2011
Showing with 10 additions and 6 deletions.
  1. +8 −4 reloadOnUpdate/index.js
  2. +2 −2 reloadOnUpdate/package.json
@@ -8,10 +8,12 @@
;
function reload() {
- try {
- appCache.swapCache();
- } catch(e) {
- // Ignore
+ if (appCache.UPDATEREADY === appCache.status) {
+ try {
+ appCache.swapCache();
+ } catch(e) {
+ // Ignore
+ }
}
location.reload();
@@ -27,4 +29,6 @@
};
appCache.on('updateready', reload, false);
+ // if we never `appCache.update()`, this will
+ // only happen on pageload
}());
@@ -9,8 +9,8 @@
},
"main": "index.js",
"engines": {
- "node": ">= 0.2.0"
+ "node": "~0.4.0"
},
"dependencies": {},
"devDependencies": {}
-}
+}

0 comments on commit 994d964

Please sign in to comment.