Add updateready event callback

This commit is contained in:
benweet 2013-04-14 22:21:49 +01:00
parent b7b63b843c
commit ac0571392b
2 changed files with 9 additions and 7 deletions

View File

@ -1 +1 @@
CACHE MANIFEST # v36 CACHE: index.html css/bootstrap.css css/jgrowl.css css/main.css js/main-min.js js/require.js NETWORK: *
CACHE MANIFEST # v37 CACHE: index.html css/bootstrap.css css/jgrowl.css css/main.css js/main-min.js js/require.js NETWORK: *

View File

@ -15,11 +15,13 @@ require(["jquery", "core"], function($, core) {
$(function() {
// If browser has detected a new application cache.
if (window.applicationCache
&& window.applicationCache.status === window.applicationCache.UPDATEREADY) {
if (window.applicationCache) {
window.applicationCache.addEventListener('updateready', function(e) {
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
window.applicationCache.swapCache();
window.location.reload();
return;
}
}, false);
}
core.init();