feature(listeners) appCache: add getConfig

This commit is contained in:
coderaiser 2013-09-19 11:58:10 +00:00
parent c817e34630
commit 02b10d68c6

View file

@ -7,10 +7,11 @@ var Util, DOM, CloudCmd;
function ListenersProto(CloudCmd, Util, DOM){
var Cache = DOM.Cache,
Events = DOM.Events;
Events = DOM.Events,
getConfig = CloudCmd.getConfig;
this.analytics = function() {
CloudCmd.getConfig(function(config) {
getConfig(function(config) {
if (config.analytics) {
Events.addOneTime('mousemove', function(){
var FIVE_SECONDS = 5000,
@ -186,14 +187,19 @@ var Util, DOM, CloudCmd;
};
function appCache() {
if (window.applicationCache)
Events.add('updateready', function() {
var ret = confirm('An update is available. Reload now?');
if (ret)
location.reload();
getConfig(function(config) {
var isAppCache = config.appcache,
appCache = window.applicationCache;
}, applicationCache);
if (isAppCache && appCache)
Events.add('updateready', function() {
var ret = confirm('An update is available. Reload now?');
if (ret)
location.reload();
}, appCache);
});
}
function contextMenu() {