-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Progressive Web Application
- Loading branch information
Showing
51 changed files
with
1,011 additions
and
62,941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
window.isUpdateAvailable = new Promise((resolve, reject) => { | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('/pwa/serviceworker.js', {scope: '/pwa/'}) | ||
.then(registration => { | ||
console.log('service worker registered with scope:', registration.scope); | ||
registration.onupdatefound = () => { | ||
const installingWorker = registration.installing; | ||
installingWorker.onstatechange = () => { | ||
switch (installingWorker.state) { | ||
case 'installed': | ||
if (navigator.serviceWorker.controller) { | ||
// update available | ||
resolve(true); | ||
} else { | ||
// no update available | ||
resolve(false); | ||
} | ||
break; | ||
} | ||
}; | ||
}; | ||
}) | ||
.catch(error => console.error('service worker registration failed:', error)); | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('/pwa/serviceworker.js', {scope: '/pwa/'}) | ||
.then(registration => { | ||
console.log('service worker registered successfully with scope:', registration.scope); | ||
|
||
if ('SyncManager' in window) | ||
console.log('Background sync supported'); | ||
else | ||
console.log('Background sync not supported'); | ||
registration.onupdatefound = () => { | ||
const installingWorker = registration.installing; | ||
installingWorker.onstatechange = () => { | ||
switch (installingWorker.state) { | ||
case 'installed': | ||
if (navigator.serviceWorker.controller) { | ||
// update available | ||
resolve(true); | ||
} else { | ||
// no update available | ||
resolve(false); | ||
} | ||
|
||
} else { | ||
console.error('Can\'t use service workers'); | ||
} | ||
}); | ||
break; | ||
} | ||
}; | ||
}; | ||
}) | ||
.catch(error => console.error('service worker registration failed:', error)); | ||
} else { | ||
console.error('Cannot use service workers'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.