Service Worker API

This commit is contained in:
tristancaron
2015-03-23 21:19:54 +01:00
parent 1e6428c347
commit d12ab0b655
2 changed files with 3 additions and 3 deletions
@@ -136,7 +136,7 @@ navigator.serviceWorker.register('service-worker.js', {scope: './'}).then(functi
// The service worker will not handle requests until this page and any
// other instances of this page (in other tabs, etc.) have been
// closed/reloaded.
var serviceWorker: ServiceWorkerRegistration;
var serviceWorker: ServiceWorker;
if (registration.installing) {
serviceWorker = registration.installing;
} else if (registration.waiting) {
@@ -146,7 +146,7 @@ navigator.serviceWorker.register('service-worker.js', {scope: './'}).then(functi
}
if (serviceWorker) {
console.log(serviceWorker.state);
serviceWorker.addEventListener('statechange', function(e: Event) {
serviceWorker.addEventListener('statechange', function(e: any) {
console.log(e.target.state);
});
}
+1 -1
View File
@@ -557,7 +557,7 @@ interface ServiceWorker extends Worker {
*
* @param [statechangeevent]
*/
onstatechange: (statechangeevent?: Event) => void;
onstatechange: (statechangeevent?: any) => void;
}
/**