Added notification when appcache is updated

This commit is contained in:
Colin McLeod
2015-06-02 23:52:23 -07:00
parent 0ae4957976
commit f0f947cad4
3 changed files with 32 additions and 0 deletions

View File

@@ -47,4 +47,15 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
$rootScope.$broadcast('close', e);
};
if ($window.applicationCache) {
// Listen for appcache updated event, present refresh to update view
$window.applicationCache.addEventListener('updateready', function(e) {
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
// Browser downloaded a new app cache.
$rootScope.appCacheUpdate = true;
$rootScope.$apply();
}
}, false);
}
}]);

View File

@@ -1,3 +1,20 @@
#app-update {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 3em;
z-index: 3;
line-height: 3em;
text-align: center;
background-color: @bg;
a, a:visited {
text-decoration: none;
color: @warning;
}
}
header {
background-color: @bg;
margin: 0;

View File

@@ -1,3 +1,7 @@
<div id="app-update" ng-show="appCacheUpdate">
<a href="#" onclick="window.location.reload()">Update Available! Click to Refresh</a>
</div>
<header>
<a class="l" ui-sref="shipyard" style="margin-right: 1em;" title="Ships"><svg class="icon xl"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#coriolis"></use></svg></a>