UNPKG

jqt

Version:

Create powerful mobile apps with just HTML, CSS, and Zepto.js (or jQuery).

1 lines 1.1 kB
!function(a){a.jQT&&a.jQT.addExtension(function(){function b(a){var b,d,e,h;b=c()?"yes":"no",d=f[g.status],e=a.type,h="online: "+b,h+=", event: "+e,h+=", status: "+d,"error"==e&&navigator.onLine&&(h+=" There was an unknown error, check your Cache Manifest."),console.log(h)}function c(){return navigator.onLine}function d(){g.update()}function e(){setInterval(function(){g.update()},1e4)}var f=[];f[0]="uncached",f[1]="idle",f[2]="checking",f[3]="downloading",f[4]="updateready",f[5]="obsolete";var g=window.applicationCache;return g.addEventListener("cached",b,!1),g.addEventListener("checking",b,!1),g.addEventListener("downloading",b,!1),g.addEventListener("error",b,!1),g.addEventListener("noupdate",b,!1),g.addEventListener("obsolete",b,!1),g.addEventListener("progress",b,!1),g.addEventListener("updateready",b,!1),a("html").attr("manifest")||console.log("No Cache Manifest listed on the <html> tag."),g.addEventListener("updateready",function(){"idle"!=f[g.status]&&(g.swapCache(),console.log("Swapped/updated the Cache Manifest."))},!1),{isOnline:c,checkForUpdates:d,autoCheckForUpdates:e}})}($);