mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 12:10:17 +09:00
17 lines
664 B
JavaScript
17 lines
664 B
JavaScript
if ('serviceWorker' in navigator) {
|
|
window.addEventListener('load', function () {
|
|
navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) {
|
|
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
|
registration.update().then(res => {
|
|
console.log('ServiceWorker registration update: ', res);
|
|
});
|
|
}, function (err) {
|
|
console.error('ServiceWorker registration failed: ', err);
|
|
});
|
|
navigator.serviceWorker.addEventListener('controllerchange', function() {
|
|
console.log('ServiceWorker controllerchange ');
|
|
window.location.reload(true);
|
|
});
|
|
});
|
|
}
|