mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(sw) register: null -> stub
This commit is contained in:
parent
95c160ca55
commit
2d7722c19f
1 changed files with 5 additions and 1 deletions
|
|
@ -3,6 +3,8 @@
|
|||
module.exports.registerSW = registerSW;
|
||||
module.exports.unregisterSW = unregisterSW;
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
async function registerSW(prefix) {
|
||||
prefix = prefix ? `/${prefix}/` : `/`;
|
||||
|
||||
|
|
@ -13,7 +15,9 @@ async function registerSW(prefix) {
|
|||
const isLocalhost = location.hostname === 'localhost';
|
||||
|
||||
if (!isHTTPS && !isLocalhost)
|
||||
return;
|
||||
return {
|
||||
addEventListener: noop,
|
||||
};
|
||||
|
||||
return navigator.serviceWorker.register(`${prefix}sw.js`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue