14 lines
376 B
JavaScript
14 lines
376 B
JavaScript
|
|
window.onload = () => {
|
||
|
|
'use strict';
|
||
|
|
if ('serviceWorker' in navigator) {
|
||
|
|
navigator.serviceWorker.register('sw.js', {
|
||
|
|
scope: '/map/'
|
||
|
|
}).then(function (reg) { // registration worked
|
||
|
|
console.log('Registration succeeded. Scope is ' + reg.scope);
|
||
|
|
}).catch(function (error) { // registration failed
|
||
|
|
console.log('Registration failed with ' + error);
|
||
|
|
});
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|