From 2d7722c19f8e8d7cf714837d4637638b3dc830ce Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 21 Sep 2018 17:28:56 +0300 Subject: [PATCH] fix(sw) register: null -> stub --- client/sw/register.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/sw/register.js b/client/sw/register.js index 18e66a2c..75fe79d3 100644 --- a/client/sw/register.js +++ b/client/sw/register.js @@ -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`); }