You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
newSWPrecacheWebpackPlugin({cacheId: 'website',filename: 'service-worker.js',maximumFileSizeToCacheInBytes: 8388608,// Ensure all our static, local assets are cached.staticFileGlobs: [path.dirname(assetsPath)+'/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,woff2}'],stripPrefix: path.dirname(assetsPath),directoryIndex: '/',verbose: true,navigateFallback: '/dist/index.html',runtimeCaching: [{urlPattern: /\/api\/widget\/load(.*)/,handler: 'networkFirst',options: {debug: true}}]})
Generated service worker (not minified):
'use strict';varprecacheConfig=[["/dist/0-caf37b552c9d7658a6e1.js","5fff3eb92ae84bea2ed56d25e0822edf"],["/dist/index.html","06fa1d9b2d02f69637ad3ccab4bfb0b7"],["/dist/main-6fbf02ae58e10b0e5b30.css","bf71bd90eb22878c2be77d64026d4aa8"],["/dist/main-6fbf02ae58e10b0e5b30.js","6c7919a1cbffc04de830c4fea8ac0ee8"]];varcacheName='sw-precache-v3-website-'+(self.registration ? self.registration.scope : '');varignoreUrlParametersMatching=[/^utm_/];varaddDirectoryIndex=function(originalUrl,index){varurl=newURL(originalUrl);if(url.pathname.slice(-1)==='/'){url.pathname+=index;}returnurl.toString();};varcleanResponse=function(originalResponse){// If this is not a redirected response, then we don't have to do anything.if(!originalResponse.redirected){returnPromise.resolve(originalResponse);}// Firefox 50 and below doesn't support the Response.body stream, so we may// need to read the entire body to memory as a Blob.varbodyPromise='body'inoriginalResponse ?
Promise.resolve(originalResponse.body) :
originalResponse.blob();returnbodyPromise.then(function(body){// new Response() is happy when passed either a stream or a Blob.returnnewResponse(body,{headers: originalResponse.headers,status: originalResponse.status,statusText: originalResponse.statusText});});};varcreateCacheKey=function(originalUrl,paramName,paramValue,dontCacheBustUrlsMatching){// Create a new URL object to avoid modifying originalUrl.varurl=newURL(originalUrl);// If dontCacheBustUrlsMatching is not set, or if we don't have a match,// then add in the extra cache-busting URL parameter.if(!dontCacheBustUrlsMatching||!(url.pathname.match(dontCacheBustUrlsMatching))){url.search+=(url.search ? '&' : '')+encodeURIComponent(paramName)+'='+encodeURIComponent(paramValue);}returnurl.toString();};varisPathWhitelisted=function(whitelist,absoluteUrlString){// If the whitelist is empty, then consider all URLs to be whitelisted.if(whitelist.length===0){returntrue;}// Otherwise compare each path regex to the path of the URL passed in.varpath=(newURL(absoluteUrlString)).pathname;returnwhitelist.some(function(whitelistedPathRegex){returnpath.match(whitelistedPathRegex);});};varstripIgnoredUrlParameters=function(originalUrl,ignoreUrlParametersMatching){varurl=newURL(originalUrl);// Remove the hash; see https://github.com/GoogleChrome/sw-precache/issues/290url.hash='';url.search=url.search.slice(1)// Exclude initial '?'.split('&')// Split into an array of 'key=value' strings.map(function(kv){returnkv.split('=');// Split each 'key=value' string into a [key, value] array}).filter(function(kv){returnignoreUrlParametersMatching.every(function(ignoredRegex){return!ignoredRegex.test(kv[0]);// Return true iff the key doesn't match any of the regexes.});}).map(function(kv){returnkv.join('=');// Join each [key, value] array into a 'key=value' string}).join('&');// Join the array of 'key=value' strings into a string with '&' in between eachreturnurl.toString();};varhashParamName='_sw-precache';varurlsToCacheKeys=newMap(precacheConfig.map(function(item){varrelativeUrl=item[0];varhash=item[1];varabsoluteUrl=newURL(relativeUrl,self.location);varcacheKey=createCacheKey(absoluteUrl,hashParamName,hash,false);return[absoluteUrl.toString(),cacheKey];}));functionsetOfCachedUrls(cache){returncache.keys().then(function(requests){returnrequests.map(function(request){returnrequest.url;});}).then(function(urls){returnnewSet(urls);});}self.addEventListener('install',function(event){event.waitUntil(caches.open(cacheName).then(function(cache){returnsetOfCachedUrls(cache).then(function(cachedUrls){returnPromise.all(Array.from(urlsToCacheKeys.values()).map(function(cacheKey){// If we don't have a key matching url in the cache already, add it.if(!cachedUrls.has(cacheKey)){varrequest=newRequest(cacheKey,{credentials: 'same-origin'});returnfetch(request).then(function(response){// Bail out of installation unless we get back a 200 OK for// every request.if(!response.ok){thrownewError('Request for '+cacheKey+' returned a '+'response with status '+response.status);}returncleanResponse(response).then(function(responseToCache){returncache.put(cacheKey,responseToCache);});});}}));});}).then(function(){// Force the SW to transition from installing -> active statereturnself.skipWaiting();}));});self.addEventListener('activate',function(event){varsetOfExpectedUrls=newSet(urlsToCacheKeys.values());event.waitUntil(caches.open(cacheName).then(function(cache){returncache.keys().then(function(existingRequests){returnPromise.all(existingRequests.map(function(existingRequest){if(!setOfExpectedUrls.has(existingRequest.url)){returncache.delete(existingRequest);}}));});}).then(function(){returnself.clients.claim();}));});self.addEventListener('fetch',function(event){if(event.request.method==='GET'){// Should we call event.respondWith() inside this fetch event handler?// This needs to be determined synchronously, which will give other fetch// handlers a chance to handle the request if need be.varshouldRespond;// First, remove all the ignored parameters and hash fragment, and see if we// have that URL in our cache. If so, great! shouldRespond will be true.varurl=stripIgnoredUrlParameters(event.request.url,ignoreUrlParametersMatching);shouldRespond=urlsToCacheKeys.has(url);// If shouldRespond is false, check again, this time with 'index.html'// (or whatever the directoryIndex option is set to) at the end.vardirectoryIndex='/';if(!shouldRespond&&directoryIndex){url=addDirectoryIndex(url,directoryIndex);shouldRespond=urlsToCacheKeys.has(url);}// If shouldRespond is still false, check to see if this is a navigation// request, and if so, whether the URL matches navigateFallbackWhitelist.varnavigateFallback='/dist/index.html';if(!shouldRespond&&navigateFallback&&(event.request.mode==='navigate')&&isPathWhitelisted([],event.request.url)){url=newURL(navigateFallback,self.location).toString();shouldRespond=urlsToCacheKeys.has(url);}// If shouldRespond was set to true at any point, then call// event.respondWith(), using the appropriate cache key.if(shouldRespond){event.respondWith(caches.open(cacheName).then(function(cache){returncache.match(urlsToCacheKeys.get(url)).then(function(response){if(response){returnresponse;}throwError('The cached response that was expected is missing.');});}).catch(function(e){// Fall back to just fetch()ing the request if some unexpected error// prevented the cached response from being valid.console.warn('Couldn\'t serve response for "%s" from cache: %O',event.request.url,e);returnfetch(event.request);}));}}});// *** Start of auto-included sw-toolbox code. ***/* Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.*/!function(e){if("object"==typeofexports&&"undefined"!=typeofmodule)module.exports=e();elseif("function"==typeofdefine&&define.amd)define([],e);else{vart;t="undefined"!=typeofwindow?window:"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:this,t.toolbox=e()}}(function(){returnfunctione(t,n,r){functiono(c,s){if(!n[c]){if(!t[c]){vara="function"==typeofrequire&&require;if(!s&&a)returna(c,!0);if(i)returni(c,!0);varu=newError("Cannot find module '"+c+"'");throwu.code="MODULE_NOT_FOUND",u}varf=n[c]={exports:{}};t[c][0].call(f.exports,function(e){varn=t[c][1][e];returno(n?n:e)},f,f.exports,e,t,n,r)}returnn[c].exports}for(vari="function"==typeofrequire&&require,c=0;c<r.length;c++)o(r[c]);returno}({1:[function(e,t,n){"use strict";functionr(e,t){t=t||{};varn=t.debug||m.debug;n&&console.log("[sw-toolbox] "+e)}functiono(e){vart;returne&&e.cache&&(t=e.cache.name),t=t||m.cache.name,caches.open(t)}functioni(e,t){t=t||{};varn=t.successResponses||m.successResponses;returnfetch(e.clone()).then(function(r){return"GET"===e.method&&n.test(r.status)&&o(t).then(function(n){n.put(e,r).then(function(){varr=t.cache||m.cache;(r.maxEntries||r.maxAgeSeconds)&&r.name&&c(e,n,r)})}),r.clone()})}functionc(e,t,n){varr=s.bind(null,e,t,n);d=d?d.then(r):r()}functions(e,t,n){varo=e.url,i=n.maxAgeSeconds,c=n.maxEntries,s=n.name,a=Date.now();returnr("Updating LRU order for "+o+". Max entries is "+c+", max age is "+i),g.getDb(s).then(function(e){returng.setTimestampForUrl(e,o,a)}).then(function(e){returng.expireEntries(e,c,i,a)}).then(function(e){r("Successfully updated IDB.");varn=e.map(function(e){returnt.delete(e)});returnPromise.all(n).then(function(){r("Done with cache cleanup.")})}).catch(function(e){r(e)})}functiona(e,t,n){returnr("Renaming cache: ["+e+"] to ["+t+"]",n),caches.delete(t).then(function(){returnPromise.all([caches.open(e),caches.open(t)]).then(function(t){varn=t[0],r=t[1];returnn.keys().then(function(e){returnPromise.all(e.map(function(e){returnn.match(e).then(function(t){returnr.put(e,t)})}))}).then(function(){returncaches.delete(e)})})})}functionu(e,t){returno(t).then(function(t){returnt.add(e)})}functionf(e,t){returno(t).then(function(t){returnt.delete(e)})}functionh(e){einstanceofPromise||p(e),m.preCacheItems=m.preCacheItems.concat(e)}functionp(e){vart=Array.isArray(e);if(t&&e.forEach(function(e){"string"==typeofe||einstanceofRequest||(t=!1)}),!t)thrownewTypeError("The precache method expects either an array of strings and/or Requests or a Promise that resolves to an array of strings and/or Requests.");returne}functionl(e,t,n){if(!e)return!1;if(t){varr=e.headers.get("date");if(r){varo=newDate(r);if(o.getTime()+1e3*t<n)return!1}}return!0}vard,m=e("./options"),g=e("./idb-cache-expiration");t.exports={debug:r,fetchAndCache:i,openCache:o,renameCache:a,cache:u,uncache:f,precache:h,validatePrecacheInput:p,isResponseFresh:l}},{"./idb-cache-expiration":2,"./options":4}],2:[function(e,t,n){"use strict";functionr(e){returnnewPromise(function(t,n){varr=indexedDB.open(u+e,f);r.onupgradeneeded=function(){vare=r.result.createObjectStore(h,{keyPath:p});e.createIndex(l,l,{unique:!1})},r.onsuccess=function(){t(r.result)},r.onerror=function(){n(r.error)}})}functiono(e){returneind||(d[e]=r(e)),d[e]}functioni(e,t,n){returnnewPromise(function(r,o){vari=e.transaction(h,"readwrite"),c=i.objectStore(h);c.put({url:t,timestamp:n}),i.oncomplete=function(){r(e)},i.onabort=function(){o(i.error)}})}functionc(e,t,n){returnt?newPromise(function(r,o){vari=1e3*t,c=[],s=e.transaction(h,"readwrite"),a=s.objectStore(h),u=a.index(l);u.openCursor().onsuccess=function(e){vart=e.target.result;if(t&&n-i>t.value[l]){varr=t.value[p];c.push(r),a.delete(r),t.continue()}},s.oncomplete=function(){r(c)},s.onabort=o}):Promise.resolve([])}functions(e,t){returnt?newPromise(function(n,r){varo=[],i=e.transaction(h,"readwrite"),c=i.objectStore(h),s=c.index(l),a=s.count();s.count().onsuccess=function(){vare=a.result;e>t&&(s.openCursor().onsuccess=function(n){varr=n.target.result;if(r){vari=r.value[p];o.push(i),c.delete(i),e-o.length>t&&r.continue()}})},i.oncomplete=function(){n(o)},i.onabort=r}):Promise.resolve([])}functiona(e,t,n,r){returnc(e,n,r).then(function(n){returns(e,t).then(function(e){returnn.concat(e)})})}varu="sw-toolbox-",f=1,h="store",p="url",l="timestamp",d={};t.exports={getDb:o,setTimestampForUrl:i,expireEntries:a}},{}],3:[function(e,t,n){"use strict";functionr(e){vart=a.match(e.request);t?e.respondWith(t(e.request)):a.default&&"GET"===e.request.method&&0===e.request.url.indexOf("http")&&e.respondWith(a.default(e.request))}functiono(e){s.debug("activate event fired");vart=u.cache.name+"$$$inactive$$$";e.waitUntil(s.renameCache(t,u.cache.name))}functioni(e){returne.reduce(function(e,t){returne.concat(t)},[])}functionc(e){vart=u.cache.name+"$$$inactive$$$";s.debug("install event fired"),s.debug("creating cache ["+t+"]"),e.waitUntil(s.openCache({cache:{name:t}}).then(function(e){returnPromise.all(u.preCacheItems).then(i).then(s.validatePrecacheInput).then(function(t){returns.debug("preCache list: "+(t.join(", ")||"(none)")),e.addAll(t)})}))}e("serviceworker-cache-polyfill");vars=e("./helpers"),a=e("./router"),u=e("./options");t.exports={fetchListener:r,activateListener:o,installListener:c}},{"./helpers":1,"./options":4,"./router":6,"serviceworker-cache-polyfill":16}],4:[function(e,t,n){"use strict";varr;r=self.registration?self.registration.scope:self.scope||newURL("./",self.location).href,t.exports={cache:{name:"$$$toolbox-cache$$$"+r+"$$$",maxAgeSeconds:null,maxEntries:null},debug:!1,networkTimeoutSeconds:null,preCacheItems:[],successResponses:/^0|([123]\d\d)|(40[14567])|410$/}},{}],5:[function(e,t,n){"use strict";varr=newURL("./",self.location),o=r.pathname,i=e("path-to-regexp"),c=function(e,t,n,r){tinstanceofRegExp?this.fullUrlRegExp=t:(0!==t.indexOf("/")&&(t=o+t),this.keys=[],this.regexp=i(t,this.keys)),this.method=e,this.options=r,this.handler=n};c.prototype.makeHandler=function(e){vart;if(this.regexp){varn=this.regexp.exec(e);t={},this.keys.forEach(function(e,r){t[e.name]=n[r+1]})}returnfunction(e){returnthis.handler(e,t,this.options)}.bind(this)},t.exports=c},{"path-to-regexp":15}],6:[function(e,t,n){"use strict";functionr(e){returne.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}varo=e("./route"),i=e("./helpers"),c=function(e,t){for(varn=e.entries(),r=n.next(),o=[];!r.done;){vari=newRegExp(r.value[0]);i.test(t)&&o.push(r.value[1]),r=n.next()}returno},s=function(){this.routes=newMap,this.routes.set(RegExp,newMap),this.default=null};["get","post","put","delete","head","any"].forEach(function(e){s.prototype[e]=function(t,n,r){returnthis.add(e,t,n,r)}}),s.prototype.add=function(e,t,n,c){c=c||{};vars;tinstanceofRegExp?s=RegExp:(s=c.origin||self.location.origin,s=sinstanceofRegExp?s.source:r(s)),e=e.toLowerCase();vara=newo(e,t,n,c);this.routes.has(s)||this.routes.set(s,newMap);varu=this.routes.get(s);u.has(e)||u.set(e,newMap);varf=u.get(e),h=a.regexp||a.fullUrlRegExp;f.has(h.source)&&i.debug('"'+t+'" resolves to same regex as existing route.'),f.set(h.source,a)},s.prototype.matchMethod=function(e,t){varn=newURL(t),r=n.origin,o=n.pathname;returnthis._match(e,c(this.routes,r),o)||this._match(e,[this.routes.get(RegExp)],t)},s.prototype._match=function(e,t,n){if(0===t.length)returnnull;for(varr=0;r<t.length;r++){varo=t[r],i=o&&o.get(e.toLowerCase());if(i){vars=c(i,n);if(s.length>0)returns[0].makeHandler(n)}}returnnull},s.prototype.match=function(e){returnthis.matchMethod(e.method,e.url)||this.matchMethod("any",e.url)},t.exports=news},{"./helpers":1,"./route":5}],7:[function(e,t,n){"use strict";functionr(e,t,n){returnn=n||{},i.debug("Strategy: cache first ["+e.url+"]",n),i.openCache(n).then(function(t){returnt.match(e).then(function(t){varr=n.cache||o.cache,c=Date.now();returni.isResponseFresh(t,r.maxAgeSeconds,c)?t:i.fetchAndCache(e,n)})})}varo=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],8:[function(e,t,n){"use strict";functionr(e,t,n){returnn=n||{},i.debug("Strategy: cache only ["+e.url+"]",n),i.openCache(n).then(function(t){returnt.match(e).then(function(e){vart=n.cache||o.cache,r=Date.now();if(i.isResponseFresh(e,t.maxAgeSeconds,r))returne})})}varo=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],9:[function(e,t,n){"use strict";functionr(e,t,n){returno.debug("Strategy: fastest ["+e.url+"]",n),newPromise(function(r,c){vars=!1,a=[],u=function(e){a.push(e.toString()),s?c(newError('Both cache and network failed: "'+a.join('", "')+'"')):s=!0},f=function(e){einstanceofResponse?r(e):u("No result returned")};o.fetchAndCache(e.clone(),n).then(f,u),i(e,t,n).then(f,u)})}varo=e("../helpers"),i=e("./cacheOnly");t.exports=r},{"../helpers":1,"./cacheOnly":8}],10:[function(e,t,n){t.exports={networkOnly:e("./networkOnly"),networkFirst:e("./networkFirst"),cacheOnly:e("./cacheOnly"),cacheFirst:e("./cacheFirst"),fastest:e("./fastest")}},{"./cacheFirst":7,"./cacheOnly":8,"./fastest":9,"./networkFirst":11,"./networkOnly":12}],11:[function(e,t,n){"use strict";functionr(e,t,n){n=n||{};varr=n.successResponses||o.successResponses,c=n.networkTimeoutSeconds||o.networkTimeoutSeconds;returni.debug("Strategy: network first ["+e.url+"]",n),i.openCache(n).then(function(t){vars,a,u=[];if(c){varf=newPromise(function(r){s=setTimeout(function(){t.match(e).then(function(e){vart=n.cache||o.cache,c=Date.now(),s=t.maxAgeSeconds;i.isResponseFresh(e,s,c)&&r(e)})},1e3*c)});u.push(f)}varh=i.fetchAndCache(e,n).then(function(e){if(s&&clearTimeout(s),r.test(e.status))returne;throwi.debug("Response was an HTTP error: "+e.statusText,n),a=e,newError("Bad response")}).catch(function(r){returni.debug("Network or response error, fallback to cache ["+e.url+"]",n),t.match(e).then(function(e){if(e)returne;if(a)returna;throwr})});returnu.push(h),Promise.race(u)})}varo=e("../options"),i=e("../helpers");t.exports=r},{"../helpers":1,"../options":4}],12:[function(e,t,n){"use strict";functionr(e,t,n){returno.debug("Strategy: network only ["+e.url+"]",n),fetch(e)}varo=e("../helpers");t.exports=r},{"../helpers":1}],13:[function(e,t,n){"use strict";varr=e("./options"),o=e("./router"),i=e("./helpers"),c=e("./strategies"),s=e("./listeners");i.debug("Service Worker Toolbox is loading"),self.addEventListener("install",s.installListener),self.addEventListener("activate",s.activateListener),self.addEventListener("fetch",s.fetchListener),t.exports={networkOnly:c.networkOnly,networkFirst:c.networkFirst,cacheOnly:c.cacheOnly,cacheFirst:c.cacheFirst,fastest:c.fastest,router:o,options:r,cache:i.cache,uncache:i.uncache,precache:i.precache}},{"./helpers":1,"./listeners":3,"./options":4,"./router":6,"./strategies":10}],14:[function(e,t,n){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],15:[function(e,t,n){functionr(e,t){for(varn,r=[],o=0,i=0,c="",s=t&&t.delimiter||"/";null!=(n=x.exec(e));){varf=n[0],h=n[1],p=n.index;if(c+=e.slice(i,p),i=p+f.length,h)c+=h[1];else{varl=e[i],d=n[2],m=n[3],g=n[4],v=n[5],w=n[6],y=n[7];c&&(r.push(c),c="");varb=null!=d&&null!=l&&l!==d,E="+"===w||"*"===w,R="?"===w||"*"===w,k=n[2]||s,$=g||v;r.push({name:m||o++,prefix:d||"",delimiter:k,optional:R,repeat:E,partial:b,asterisk:!!y,pattern:$?u($):y?".*":"[^"+a(k)+"]+?"})}}returni<e.length&&(c+=e.substr(i)),c&&r.push(c),r}functiono(e,t){returns(r(e,t))}functioni(e){returnencodeURI(e).replace(/[\/?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}functionc(e){returnencodeURI(e).replace(/[?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}functions(e){for(vart=newArray(e.length),n=0;n<e.length;n++)"object"==typeofe[n]&&(t[n]=newRegExp("^(?:"+e[n].pattern+")$"));returnfunction(n,r){for(varo="",s=n||{},a=r||{},u=a.pretty?i:encodeURIComponent,f=0;f<e.length;f++){varh=e[f];if("string"!=typeofh){varp,l=s[h.name];if(null==l){if(h.optional){h.partial&&(o+=h.prefix);continue}thrownewTypeError('Expected "'+h.name+'" to be defined')}if(v(l)){if(!h.repeat)thrownewTypeError('Expected "'+h.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(0===l.length){if(h.optional)continue;thrownewTypeError('Expected "'+h.name+'" to not be empty')}for(vard=0;d<l.length;d++){if(p=u(l[d]),!t[f].test(p))thrownewTypeError('Expected all "'+h.name+'" to match "'+h.pattern+'", but received `'+JSON.stringify(p)+"`");o+=(0===d?h.prefix:h.delimiter)+p}}else{if(p=h.asterisk?c(l):u(l),!t[f].test(p))thrownewTypeError('Expected "'+h.name+'" to match "'+h.pattern+'", but received "'+p+'"');o+=h.prefix+p}}elseo+=h}returno}}functiona(e){returne.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}functionu(e){returne.replace(/([=!:$\/()])/g,"\\$1")}functionf(e,t){returne.keys=t,e}functionh(e){returne.sensitive?"":"i"}functionp(e,t){varn=e.source.match(/\((?!\?)/g);if(n)for(varr=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});returnf(e,t)}functionl(e,t,n){for(varr=[],o=0;o<e.length;o++)r.push(g(e[o],t,n).source);vari=newRegExp("(?:"+r.join("|")+")",h(n));returnf(i,t)}functiond(e,t,n){returnm(r(e,n),t,n)}functionm(e,t,n){v(t)||(n=t||n,t=[]),n=n||{};for(varr=n.strict,o=n.end!==!1,i="",c=0;c<e.length;c++){vars=e[c];if("string"==typeofs)i+=a(s);else{varu=a(s.prefix),p="(?:"+s.pattern+")";t.push(s),s.repeat&&(p+="(?:"+u+p+")*"),p=s.optional?s.partial?u+"("+p+")?":"(?:"+u+"("+p+"))?":u+"("+p+")",i+=p}}varl=a(n.delimiter||"/"),d=i.slice(-l.length)===l;returnr||(i=(d?i.slice(0,-l.length):i)+"(?:"+l+"(?=$))?"),i+=o?"$":r&&d?"":"(?="+l+"|$)",f(newRegExp("^"+i,h(n)),t)}functiong(e,t,n){returnv(t)||(n=t||n,t=[]),n=n||{},einstanceofRegExp?p(e,t):v(e)?l(e,t,n):d(e,t,n)}varv=e("isarray");t.exports=g,t.exports.parse=r,t.exports.compile=o,t.exports.tokensToFunction=s,t.exports.tokensToRegExp=m;varx=newRegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g")},{isarray:14}],16:[function(e,t,n){!function(){vare=Cache.prototype.addAll,t=navigator.userAgent.match(/(Firefox|Chrome)\/(\d+\.)/);if(t)varn=t[1],r=parseInt(t[2]);e&&(!t||"Firefox"===n&&r>=46||"Chrome"===n&&r>=50)||(Cache.prototype.addAll=function(e){functiont(e){this.name="NetworkError",this.code=19,this.message=e}varn=this;returnt.prototype=Object.create(Error.prototype),Promise.resolve().then(function(){if(arguments.length<1)thrownewTypeError;returne=e.map(function(e){returneinstanceofRequest?e:String(e)}),Promise.all(e.map(function(e){"string"==typeofe&&(e=newRequest(e));varn=newURL(e.url).protocol;if("http:"!==n&&"https:"!==n)thrownewt("Invalid scheme");returnfetch(e.clone())}))}).then(function(r){if(r.some(function(e){return!e.ok}))thrownewt("Incorrect response status");returnPromise.all(r.map(function(t,r){returnn.put(e[r],t)}))}).then(function(){})},Cache.prototype.add=function(e){returnthis.addAll([e])})}()},{}]},{},[13])(13)});// *** End of auto-included sw-toolbox code. ***// Runtime cache configuration, using the sw-toolbox library.toolbox.router.get(/\/api\/widget\/load(.*)/,toolbox.networkFirst,{"debug":true});
Thanks!
The text was updated successfully, but these errors were encountered:
You'll need to put an interval in your code right after you get the registration. Have it call .update on the registration. Set a window global property to be a promise, inside your onupdatefound, resolve the promise. On load, have main.js .then against that promise and reload when resolved.
webpack version:
3.10
sw-precache-webpack-plugin version:
0.11.3
Please tell us about your environment:
OSX 10.13.3
Browser:
Chrome 65.0.3325.181
Current behavior:
When I update my website a new service worker is generated, but it doesn't emit an
updatefound
event. So, the user stays on the old version.Expected/desired behavior:
I would like to listen the
updatefound
event to tell the user that there has been an update and that he can/must reload.I use this code, but the event isn't emitted:
Thanks!
The text was updated successfully, but these errors were encountered: