Skip to content
Browse files

Use another (smart) method to speed up the update rate.

  • Loading branch information...
1 parent 47705a0 commit f10f76d0fca664adc029244a50f8910dec181b96 @cheeaun cheeaun committed Mar 17, 2012
Showing with 8 additions and 2 deletions.
  1. +7 −1 hn.js
  2. +1 −1 manifest.appcache
View
8 hn.js
@@ -444,13 +444,19 @@
}, 15);
}, false);
- // Programmatically update the app cache
+ // "Naturally" reload when an update is available
if (w.applicationCache) w.addEventListener('load', function(){
+ var reload = false;
w.applicationCache.addEventListener('updateready', function(){
if (w.applicationCache.status == w.applicationCache.UPDATEREADY){
w.applicationCache.swapCache();
+ reload = true;
}
}, false);
+
+ w.addEventListener('pageshow', function(){
+ if (reload) location.reload();
+ }, false);
}, false);
// Use GA to track the update rate of this manifest appcache thing
View
2 manifest.appcache
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# 2012-03-15:v1
+# 2012-03-17:v1
index.html
hn.css

0 comments on commit f10f76d

Please sign in to comment.
Something went wrong with that request. Please try again.