sw-background-sync-queue
Advanced tools
Comparing version 0.0.16 to 0.0.18
@@ -29,2 +29,3 @@ /* | ||
const allQueuesPlaceholder = 'QUEUES'; | ||
const replayAllQueuesTag = 'SW_BACKGROUND_QUEUE_TAG_REPLAY'; | ||
@@ -1189,3 +1190,3 @@ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
self.addEventListener('sync', event => { | ||
if (event.tag === tagNamePrefix + this._queue.queueName) { | ||
if (event.tag === tagNamePrefix + this._queue.queueName || event.tag === replayAllQueuesTag) { | ||
event.waitUntil(this.replayRequests()); | ||
@@ -1192,0 +1193,0 @@ } |
@@ -15,10 +15,10 @@ /* | ||
*/ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports):'function'==typeof define&&define.amd?define(['exports'],b):b((a.goog=a.goog||{},a.goog.backgroundSyncQueue=a.goog.backgroundSyncQueue||{}))})(this,function(a){'use strict';function createCommonjsModule(F,G){return G={exports:{}},F(G,G.exports),G.exports}function throwError(F){const G=new Error(F),H=r.parse(G);throw 3<=H.length&&(G.message=`Invalid call to ${H[2].functionName}() — `+F.replace(/\s+/g,' '),G.name=H[1].functionName.replace(/^Object\./,'')),G}function setDbName(F){s.isType({dbName:F},'string'),t=F}function getDbName(){return t}function broadcastMessage({broadcastChannel:F,type:G,url:H}){F&&(s.isInstance({broadcastChannel:F},BroadcastChannel),s.isType({type:G},'string'),s.isType({url:H},'string'),F.postMessage({type:G,meta:l,payload:{url:H}}))}const h='SW_BACKGROUND_QUEUE_TAG_',l='SW_BACKGROUND_SYNC_QUEUE',m='QUEUES';var o='undefined'==typeof window?'undefined'==typeof global?'undefined'==typeof self?{}:self:global:window,q=createCommonjsModule(function(F){(function(H,I){'use strict';F.exports=I()})(o,function(){'use strict';function _isNumber(O){return!isNaN(parseFloat(O))&&isFinite(O)}function _capitalize(O){return O[0].toUpperCase()+O.substring(1)}function _getter(O){return function(){return this[O]}}function StackFrame(O){if(O instanceof Object)for(var P=H.concat(I.concat(J.concat(K))),Q=0;Q<P.length;Q++)O.hasOwnProperty(P[Q])&&void 0!==O[P[Q]]&&this['set'+_capitalize(P[Q])](O[P[Q]])}var H=['isConstructor','isEval','isNative','isToplevel'],I=['columnNumber','lineNumber'],J=['fileName','functionName','source'],K=['args'];StackFrame.prototype={getArgs:function(){return this.args},setArgs:function(O){if('[object Array]'!==Object.prototype.toString.call(O))throw new TypeError('Args must be an Array');this.args=O},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(O){if(O instanceof StackFrame)this.evalOrigin=O;else if(O instanceof Object)this.evalOrigin=new StackFrame(O);else throw new TypeError('Eval Origin must be an Object or StackFrame')},toString:function(){var O=this.getFunctionName()||'{anonymous}',P='('+(this.getArgs()||[]).join(',')+')',Q=this.getFileName()?'@'+this.getFileName():'',R=_isNumber(this.getLineNumber())?':'+this.getLineNumber():'',S=_isNumber(this.getColumnNumber())?':'+this.getColumnNumber():'';return O+P+Q+R+S}};for(var L=0;L<H.length;L++)StackFrame.prototype['get'+_capitalize(H[L])]=_getter(H[L]),StackFrame.prototype['set'+_capitalize(H[L])]=function(O){return function(P){this[O]=!!P}}(H[L]);for(var M=0;M<I.length;M++)StackFrame.prototype['get'+_capitalize(I[M])]=_getter(I[M]),StackFrame.prototype['set'+_capitalize(I[M])]=function(O){return function(P){if(!_isNumber(P))throw new TypeError(O+' must be a Number');this[O]=+P}}(I[M]);for(var N=0;N<J.length;N++)StackFrame.prototype['get'+_capitalize(J[N])]=_getter(J[N]),StackFrame.prototype['set'+_capitalize(J[N])]=function(O){return function(P){this[O]=P+''}}(J[N]);return StackFrame})}),r=createCommonjsModule(function(F){(function(H,I){'use strict';F.exports=I(q)})(o,function ErrorStackParser(H){'use strict';var I=/(^|@)\S+\:\d+/,J=/^\s*at .*(\S+\:\d+|\(native\))/m,K=/^(eval@)?(\[native code\])?$/;return{parse:function ErrorStackParser$$parse(L){if('undefined'!=typeof L.stacktrace||'undefined'!=typeof L['opera#sourceloc'])return this.parseOpera(L);if(L.stack&&L.stack.match(J))return this.parseV8OrIE(L);if(L.stack)return this.parseFFOrSafari(L);throw new Error('Cannot parse given Error object')},extractLocation:function ErrorStackParser$$extractLocation(L){if(-1===L.indexOf(':'))return[L];var M=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/,N=M.exec(L.replace(/[\(\)]/g,''));return[N[1],N[2]||void 0,N[3]||void 0]},parseV8OrIE:function ErrorStackParser$$parseV8OrIE(L){var M=L.stack.split('\n').filter(function(N){return!!N.match(J)},this);return M.map(function(N){-1<N.indexOf('(eval ')&&(N=N.replace(/eval code/g,'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,''));var O=N.replace(/^\s+/,'').replace(/\(eval code/g,'(').split(/\s+/).slice(1),P=this.extractLocation(O.pop()),Q=O.join(' ')||void 0,R=-1<['eval','<anonymous>'].indexOf(P[0])?void 0:P[0];return new H({functionName:Q,fileName:R,lineNumber:P[1],columnNumber:P[2],source:N})},this)},parseFFOrSafari:function ErrorStackParser$$parseFFOrSafari(L){var M=L.stack.split('\n').filter(function(N){return!N.match(K)},this);return M.map(function(N){if(-1<N.indexOf(' > eval')&&(N=N.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,':$1')),-1===N.indexOf('@')&&-1===N.indexOf(':'))return new H({functionName:N});var O=N.split('@'),P=this.extractLocation(O.pop()),Q=O.join('@')||void 0;return new H({functionName:Q,fileName:P[0],lineNumber:P[1],columnNumber:P[2],source:N})},this)},parseOpera:function ErrorStackParser$$parseOpera(L){return!L.stacktrace||-1<L.message.indexOf('\n')&&L.message.split('\n').length>L.stacktrace.split('\n').length?this.parseOpera9(L):L.stack?this.parseOpera11(L):this.parseOpera10(L)},parseOpera9:function ErrorStackParser$$parseOpera9(L){for(var R,M=/Line (\d+).*script (?:in )?(\S+)/i,N=L.message.split('\n'),O=[],P=2,Q=N.length;P<Q;P+=2)R=M.exec(N[P]),R&&O.push(new H({fileName:R[2],lineNumber:R[1],source:N[P]}));return O},parseOpera10:function ErrorStackParser$$parseOpera10(L){for(var R,M=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,N=L.stacktrace.split('\n'),O=[],P=0,Q=N.length;P<Q;P+=2)R=M.exec(N[P]),R&&O.push(new H({functionName:R[3]||void 0,fileName:R[2],lineNumber:R[1],source:N[P]}));return O},parseOpera11:function ErrorStackParser$$parseOpera11(L){var M=L.stack.split('\n').filter(function(N){return!!N.match(I)&&!N.match(/^Error created at/)},this);return M.map(function(N){var O=N.split('@'),P=this.extractLocation(O.pop()),Q=O.shift()||'',R=Q.replace(/<anonymous function(: (\w+))?>/,'$2').replace(/\([^\)]*\)/g,'')||void 0,S;Q.match(/\(([^\)]*)\)/)&&(S=Q.replace(/^[^\(]+\(([^\)]*)\)$/,'$1'));var T=S===void 0||'[arguments not available]'===S?void 0:S.split(',');return new H({functionName:R,args:T,fileName:P[0],lineNumber:P[1],columnNumber:P[2],source:N})},this)}}})}),s={atLeastOne:function atLeastOne(F){const G=Object.keys(F);G.some((H)=>F[H]!==void 0)||throwError('Please set at least one of the following parameters: '+G.map((H)=>`'${H}'`).join(', '))},hasMethod:function hasMethod(F,G){const H=Object.keys(F).pop(),I=typeof F[H][G];'function'!=I&&throwError(`The '${H}' parameter must be an object that exposes a | ||
'${G}' method.`)},isInstance:function isInstance(F,G){const H=Object.keys(F).pop();F[H]instanceof G||throwError(`The '${H}' parameter must be an instance of | ||
'${G.name}'`)},isOneOf:function isOneOf(F,G){const H=Object.keys(F).pop();G.includes(F[H])||throwError(`The '${H}' parameter must be set to one of the | ||
following: ${G}`)},isType:function isType(F,G){const H=Object.keys(F).pop(),I=typeof F[H];I!==G&&throwError(`The '${H}' parameter has the wrong type. (Expected: | ||
${G}, actual: ${I})`)},isSWEnv:function isSWEnv(){return'ServiceWorkerGlobalScope'in self&&self instanceof ServiceWorkerGlobalScope},isValue:function isValue(F,G){const H=Object.keys(F).pop(),I=F[H];I!==G&&throwError(`The '${H}' parameter has the wrong value. (Expected: | ||
${G}, actual: ${I})`)},isArrayOfType:function isArrayOfType(F,G){const H=Object.keys(F).pop(),I=`The '${H}' parameter should be an array containing | ||
one or more '${G}' elements.`;Array.isArray(F[H])||throwError(I);for(let J of F[H])typeof J!==G&&throwError(I)},isArrayOfClass:function isArrayOfClass(F,G){const H=Object.keys(F).pop(),I=`The '${H}' parameter should be an array containing | ||
one or more '${G.name}' instances.`;Array.isArray(F[H])||throwError(I);for(let J of F[H])J instanceof G||throwError(I)}};let t='bgQueueSyncDB';var u=createCommonjsModule(function(F){'use strict';(function(){function toArray(H){return Array.prototype.slice.call(H)}function promisifyRequest(H){return new Promise(function(I,J){H.onsuccess=function(){I(H.result)},H.onerror=function(){J(H.error)}})}function promisifyRequestCall(H,I,J){var K,L=new Promise(function(M,N){K=H[I].apply(H,J),promisifyRequest(K).then(M,N)});return L.request=K,L}function promisifyCursorRequestCall(H,I,J){var K=promisifyRequestCall(H,I,J);return K.then(function(L){return L?new Cursor(L,K.request):void 0})}function proxyProperties(H,I,J){J.forEach(function(K){Object.defineProperty(H.prototype,K,{get:function(){return this[I][K]},set:function(L){this[I][K]=L}})})}function proxyRequestMethods(H,I,J,K){K.forEach(function(L){L in J.prototype&&(H.prototype[L]=function(){return promisifyRequestCall(this[I],L,arguments)})})}function proxyMethods(H,I,J,K){K.forEach(function(L){L in J.prototype&&(H.prototype[L]=function(){return this[I][L].apply(this[I],arguments)})})}function proxyCursorRequestMethods(H,I,J,K){K.forEach(function(L){L in J.prototype&&(H.prototype[L]=function(){return promisifyCursorRequestCall(this[I],L,arguments)})})}function Index(H){this._index=H}function Cursor(H,I){this._cursor=H,this._request=I}function ObjectStore(H){this._store=H}function Transaction(H){this._tx=H,this.complete=new Promise(function(I,J){H.oncomplete=function(){I()},H.onerror=function(){J(H.error)},H.onabort=function(){J(H.error)}})}function UpgradeDB(H,I,J){this._db=H,this.oldVersion=I,this.transaction=new Transaction(J)}function DB(H){this._db=H}proxyProperties(Index,'_index',['name','keyPath','multiEntry','unique']),proxyRequestMethods(Index,'_index',IDBIndex,['get','getKey','getAll','getAllKeys','count']),proxyCursorRequestMethods(Index,'_index',IDBIndex,['openCursor','openKeyCursor']),proxyProperties(Cursor,'_cursor',['direction','key','primaryKey','value']),proxyRequestMethods(Cursor,'_cursor',IDBCursor,['update','delete']),['advance','continue','continuePrimaryKey'].forEach(function(H){H in IDBCursor.prototype&&(Cursor.prototype[H]=function(){var I=this,J=arguments;return Promise.resolve().then(function(){return I._cursor[H].apply(I._cursor,J),promisifyRequest(I._request).then(function(K){return K?new Cursor(K,I._request):void 0})})})}),ObjectStore.prototype.createIndex=function(){return new Index(this._store.createIndex.apply(this._store,arguments))},ObjectStore.prototype.index=function(){return new Index(this._store.index.apply(this._store,arguments))},proxyProperties(ObjectStore,'_store',['name','keyPath','indexNames','autoIncrement']),proxyRequestMethods(ObjectStore,'_store',IDBObjectStore,['put','add','delete','clear','get','getAll','getKey','getAllKeys','count']),proxyCursorRequestMethods(ObjectStore,'_store',IDBObjectStore,['openCursor','openKeyCursor']),proxyMethods(ObjectStore,'_store',IDBObjectStore,['deleteIndex']),Transaction.prototype.objectStore=function(){return new ObjectStore(this._tx.objectStore.apply(this._tx,arguments))},proxyProperties(Transaction,'_tx',['objectStoreNames','mode']),proxyMethods(Transaction,'_tx',IDBTransaction,['abort']),UpgradeDB.prototype.createObjectStore=function(){return new ObjectStore(this._db.createObjectStore.apply(this._db,arguments))},proxyProperties(UpgradeDB,'_db',['name','version','objectStoreNames']),proxyMethods(UpgradeDB,'_db',IDBDatabase,['deleteObjectStore','close']),DB.prototype.transaction=function(){return new Transaction(this._db.transaction.apply(this._db,arguments))},proxyProperties(DB,'_db',['name','version','objectStoreNames']),proxyMethods(DB,'_db',IDBDatabase,['close']),['openCursor','openKeyCursor'].forEach(function(H){[ObjectStore,Index].forEach(function(I){I.prototype[H.replace('open','iterate')]=function(){var J=toArray(arguments),K=J[J.length-1],L=this._store||this._index,M=L[H].apply(L,J.slice(0,-1));M.onsuccess=function(){K(M.result)}}})}),[Index,ObjectStore].forEach(function(H){H.prototype.getAll||(H.prototype.getAll=function(I,J){var K=this,L=[];return new Promise(function(M){K.iterateCursor(I,function(N){return N?(L.push(N.value),void 0!==J&&L.length==J?void M(L):void N.continue()):void M(L)})})})});F.exports={open:function(H,I,J){var K=promisifyRequestCall(indexedDB,'open',[H,I]),L=K.request;return L.onupgradeneeded=function(M){J&&J(new UpgradeDB(L.result,M.oldVersion,L.transaction))},K.then(function(M){return new DB(M)})},delete:function(H){return promisifyRequestCall(indexedDB,'deleteDatabase',[H])}}})()});class IDBHelper{constructor(F,G,H){if(F==void 0||G==void 0||H==void 0)throw Error('name, version, storeName must be passed to the constructor.');this._name=F,this._version=G,this._storeName=H}_getDb(){return this._dbPromise?this._dbPromise:(this._dbPromise=u.open(this._name,this._version,(F)=>{F.createObjectStore(this._storeName)}).then((F)=>{return F}),this._dbPromise)}close(){return this._dbPromise?this._dbPromise.then((F)=>{F.close(),this._dbPromise=null}):void 0}put(F,G){return this._getDb().then((H)=>{const I=H.transaction(this._storeName,'readwrite'),J=I.objectStore(this._storeName);return J.put(G,F),I.complete})}delete(F){return this._getDb().then((G)=>{const H=G.transaction(this._storeName,'readwrite'),I=H.objectStore(this._storeName);return I.delete(F),H.complete})}get(F){return this._getDb().then((G)=>{return G.transaction(this._storeName).objectStore(this._storeName).get(F)})}getAllValues(){return this._getDb().then((F)=>{return F.transaction(this._storeName).objectStore(this._storeName).getAll()})}getAllKeys(){return this._getDb().then((F)=>{return F.transaction(this._storeName).objectStore(this._storeName).getAllKeys()})}}var w=function(F){return function(){var G=F.apply(this,arguments);return new Promise(function(H,I){function step(J,K){try{var L=G[J](K),M=L.value}catch(N){return void I(N)}return L.done?void H(M):Promise.resolve(M).then(function(N){step('next',N)},function(N){step('throw',N)})}return step('next')})}};let x=(()=>{var F=w(function*({hash:G,idbObject:H,response:I,idbQDb:J}){H.response={headers:JSON.stringify([...I.headers]),status:I.status,body:yield I.blob()},J.put(G,H)});return function putResponse(){return F.apply(this,arguments)}})(),y=(()=>{var F=w(function*({id:G}){const H=new IDBHelper(getDbName(),1,'QueueStore'),I=yield H.get(G);return I&&I.response?I.response:null});return function getResponse(){return F.apply(this,arguments)}})(),z=(()=>{var F=w(function*({request:G,config:H}){let I={config:H,metadata:{creationTimestamp:Date.now()},request:{url:G.url,headers:JSON.stringify([...G.headers]),mode:G.mode,method:G.method,redirect:G.redirect,credentials:G.credentials}};const J=yield G.text();return 0<J.length&&(I.request.body=J),I});return function getQueueableRequest(){return F.apply(this,arguments)}})(),A=(()=>{var F=w(function*({idbRequestObject:G}){let H={mode:G.mode,method:G.method,redirect:G.redirect,headers:new Headers(JSON.parse(G.headers)),credentials:G.credentials};return G.body&&(H.body=G.body),new Request(G.url,H)});return function getFetchableRequest(){return F.apply(this,arguments)}})(),B=(()=>{var F=w(function*(){let G=new IDBHelper(getDbName(),1,'QueueStore'),H=yield G.get(m);return H?void(yield Promise.all(H.map((()=>{var I=w(function*(J){const K=yield G.get(J);let L=[],M=[];yield Promise.all(K.map((()=>{var N=w(function*(O){const P=yield G.get(O);P&&P.metadata&&P.metadata.creationTimestamp+P.config.maxAge<=Date.now()?M.push(G.delete(O)):L.push(O)});return function(){return N.apply(this,arguments)}})())),yield Promise.all(M),G.put(J,L)});return function(){return I.apply(this,arguments)}})()))):null});return function cleanupQueue(){return F.apply(this,arguments)}})();class RequestManager{constructor({callbacks:F,queue:G}){this._globalCallbacks=F||{},this._queue=G,this.attachSyncHandler()}attachSyncHandler(){self.addEventListener('sync',(F)=>{F.tag===h+this._queue.queueName&&F.waitUntil(this.replayRequests())})}replayRequests(){var F=this;return this._queue.queue.reduce((G,H)=>{return G.then((()=>{var I=w(function*(){const K=yield F._queue.getRequestFromQueue({hash:H});if(!K.response){const L=yield A({idbRequestObject:K.request});return fetch(L).then(function(M){return M.ok?void(x({hash:H,idbObject:K,response:M.clone(),idbQDb:F._queue.idbQDb}),F._globalCallbacks.onResponse&&F._globalCallbacks.onResponse(H,M)):Promise.resolve()}).catch(function(M){F._globalCallbacks.onRetryFailure&&F._globalCallbacks.onRetryFailure(H,M)})}});return function(){return I.apply(this,arguments)}})())},Promise.resolve())}}let C=0,D=0;class RequestQueue{constructor({config:F,queueName:I='DEFAULT_QUEUE'+'_'+D++,idbQDb:G,broadcastChannel:H}){this._isQueueNameAddedToAllQueue=!1,this._queueName=I,this._config=F,this._idbQDb=G,this._broadcastChannel=H,this._queue=[],this.initQueue()}initQueue(){var F=this;return w(function*(){const G=yield F._idbQDb.get(F._queueName);F._queue.concat(G)})()}addQueueNameToAllQueues(){var F=this;return w(function*(){if(!F._isQueueNameAddedToAllQueue){let G=yield F._idbQDb.get(m);G=G||[],G.includes(F._queueName)||G.push(F._queueName),F._idbQDb.put(m,G),F._isQueueNameAddedToAllQueue=!0}})()}saveQueue(){var F=this;return w(function*(){yield F._idbQDb.put(F._queueName,F._queue)})()}push({request:F}){var G=this;return w(function*(){s.isInstance({request:F},Request);const H=`${F.url}!${Date.now()}!${C++}`,I=yield z({request:F,config:G._config});try{G._queue.push(H),G.saveQueue(),G._idbQDb.put(H,I),yield G.addQueueNameToAllQueues(),self.registration&&self.registration.sync.register(h+G._queueName),broadcastMessage({broadcastChannel:G._broadcastChannel,type:'BACKGROUND_REQUESTED_ADDED',id:H,url:F.url})}catch(J){broadcastMessage({broadcastChannel:G._broadcastChannel,type:'BACKGROUND_REQUESTED_FAILED',id:H,url:F.url})}})()}getRequestFromQueue({hash:F}){var G=this;return w(function*(){if(s.isType({hash:F},'string'),G._queue.includes(F))return yield G._idbQDb.get(F)})()}get queue(){return Object.assign([],this._queue)}get queueName(){return this._queueName}get idbQDb(){return this._idbQDb}}let E=(()=>{var F=w(function*({dbName:G}={}){G&&(s.isType({dbName:G},'string'),setDbName(G)),yield B()});return function initialize(){return F.apply(this,arguments)}})();a.initialize=E,a.getResponse=y,a.BackgroundSyncQueue=class BackgroundSyncQueue{constructor({maxRetentionTime:I=432000000,callbacks:F,queueName:G,broadcastChannel:H}={}){G&&s.isType({queueName:G},'string'),I&&s.isType({maxRetentionTime:I},'number'),H&&s.isInstance({broadcastChannel:H},BroadcastChannel),this._queue=new RequestQueue({config:{maxAge:I},queueName:G,idbQDb:new IDBHelper(getDbName(),1,'QueueStore'),broadcastChannel:H}),this._requestManager=new RequestManager({callbacks:F,queue:this._queue})}pushIntoQueue({request:F}){return s.isInstance({request:F},Request),this._queue.push({request:F})}fetchDidFail({request:F}){return this.pushIntoQueue({request:F})}},Object.defineProperty(a,'__esModule',{value:!0})}); | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports):'function'==typeof define&&define.amd?define(['exports'],b):b((a.goog=a.goog||{},a.goog.backgroundSyncQueue=a.goog.backgroundSyncQueue||{}))})(this,function(a){'use strict';function createCommonjsModule(G,H){return H={exports:{}},G(H,H.exports),H.exports}function throwError(G){const H=new Error(G),I=s.parse(H);throw 3<=I.length&&(H.message=`Invalid call to ${I[2].functionName}() — `+G.replace(/\s+/g,' '),H.name=I[1].functionName.replace(/^Object\./,'')),H}function setDbName(G){t.isType({dbName:G},'string'),u=G}function getDbName(){return u}function broadcastMessage({broadcastChannel:G,type:H,url:I}){G&&(t.isInstance({broadcastChannel:G},BroadcastChannel),t.isType({type:H},'string'),t.isType({url:I},'string'),G.postMessage({type:H,meta:l,payload:{url:I}}))}const h='SW_BACKGROUND_QUEUE_TAG_',l='SW_BACKGROUND_SYNC_QUEUE',m='QUEUES';var q='undefined'==typeof window?'undefined'==typeof global?'undefined'==typeof self?{}:self:global:window,r=createCommonjsModule(function(G){(function(I,J){'use strict';G.exports=J()})(q,function(){'use strict';function _isNumber(P){return!isNaN(parseFloat(P))&&isFinite(P)}function _capitalize(P){return P[0].toUpperCase()+P.substring(1)}function _getter(P){return function(){return this[P]}}function StackFrame(P){if(P instanceof Object)for(var Q=I.concat(J.concat(K.concat(L))),R=0;R<Q.length;R++)P.hasOwnProperty(Q[R])&&void 0!==P[Q[R]]&&this['set'+_capitalize(Q[R])](P[Q[R]])}var I=['isConstructor','isEval','isNative','isToplevel'],J=['columnNumber','lineNumber'],K=['fileName','functionName','source'],L=['args'];StackFrame.prototype={getArgs:function(){return this.args},setArgs:function(P){if('[object Array]'!==Object.prototype.toString.call(P))throw new TypeError('Args must be an Array');this.args=P},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(P){if(P instanceof StackFrame)this.evalOrigin=P;else if(P instanceof Object)this.evalOrigin=new StackFrame(P);else throw new TypeError('Eval Origin must be an Object or StackFrame')},toString:function(){var P=this.getFunctionName()||'{anonymous}',Q='('+(this.getArgs()||[]).join(',')+')',R=this.getFileName()?'@'+this.getFileName():'',S=_isNumber(this.getLineNumber())?':'+this.getLineNumber():'',T=_isNumber(this.getColumnNumber())?':'+this.getColumnNumber():'';return P+Q+R+S+T}};for(var M=0;M<I.length;M++)StackFrame.prototype['get'+_capitalize(I[M])]=_getter(I[M]),StackFrame.prototype['set'+_capitalize(I[M])]=function(P){return function(Q){this[P]=!!Q}}(I[M]);for(var N=0;N<J.length;N++)StackFrame.prototype['get'+_capitalize(J[N])]=_getter(J[N]),StackFrame.prototype['set'+_capitalize(J[N])]=function(P){return function(Q){if(!_isNumber(Q))throw new TypeError(P+' must be a Number');this[P]=+Q}}(J[N]);for(var O=0;O<K.length;O++)StackFrame.prototype['get'+_capitalize(K[O])]=_getter(K[O]),StackFrame.prototype['set'+_capitalize(K[O])]=function(P){return function(Q){this[P]=Q+''}}(K[O]);return StackFrame})}),s=createCommonjsModule(function(G){(function(I,J){'use strict';G.exports=J(r)})(q,function ErrorStackParser(I){'use strict';var J=/(^|@)\S+\:\d+/,K=/^\s*at .*(\S+\:\d+|\(native\))/m,L=/^(eval@)?(\[native code\])?$/;return{parse:function ErrorStackParser$$parse(M){if('undefined'!=typeof M.stacktrace||'undefined'!=typeof M['opera#sourceloc'])return this.parseOpera(M);if(M.stack&&M.stack.match(K))return this.parseV8OrIE(M);if(M.stack)return this.parseFFOrSafari(M);throw new Error('Cannot parse given Error object')},extractLocation:function ErrorStackParser$$extractLocation(M){if(-1===M.indexOf(':'))return[M];var N=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/,O=N.exec(M.replace(/[\(\)]/g,''));return[O[1],O[2]||void 0,O[3]||void 0]},parseV8OrIE:function ErrorStackParser$$parseV8OrIE(M){var N=M.stack.split('\n').filter(function(O){return!!O.match(K)},this);return N.map(function(O){-1<O.indexOf('(eval ')&&(O=O.replace(/eval code/g,'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,''));var P=O.replace(/^\s+/,'').replace(/\(eval code/g,'(').split(/\s+/).slice(1),Q=this.extractLocation(P.pop()),R=P.join(' ')||void 0,S=-1<['eval','<anonymous>'].indexOf(Q[0])?void 0:Q[0];return new I({functionName:R,fileName:S,lineNumber:Q[1],columnNumber:Q[2],source:O})},this)},parseFFOrSafari:function ErrorStackParser$$parseFFOrSafari(M){var N=M.stack.split('\n').filter(function(O){return!O.match(L)},this);return N.map(function(O){if(-1<O.indexOf(' > eval')&&(O=O.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,':$1')),-1===O.indexOf('@')&&-1===O.indexOf(':'))return new I({functionName:O});var P=O.split('@'),Q=this.extractLocation(P.pop()),R=P.join('@')||void 0;return new I({functionName:R,fileName:Q[0],lineNumber:Q[1],columnNumber:Q[2],source:O})},this)},parseOpera:function ErrorStackParser$$parseOpera(M){return!M.stacktrace||-1<M.message.indexOf('\n')&&M.message.split('\n').length>M.stacktrace.split('\n').length?this.parseOpera9(M):M.stack?this.parseOpera11(M):this.parseOpera10(M)},parseOpera9:function ErrorStackParser$$parseOpera9(M){for(var S,N=/Line (\d+).*script (?:in )?(\S+)/i,O=M.message.split('\n'),P=[],Q=2,R=O.length;Q<R;Q+=2)S=N.exec(O[Q]),S&&P.push(new I({fileName:S[2],lineNumber:S[1],source:O[Q]}));return P},parseOpera10:function ErrorStackParser$$parseOpera10(M){for(var S,N=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,O=M.stacktrace.split('\n'),P=[],Q=0,R=O.length;Q<R;Q+=2)S=N.exec(O[Q]),S&&P.push(new I({functionName:S[3]||void 0,fileName:S[2],lineNumber:S[1],source:O[Q]}));return P},parseOpera11:function ErrorStackParser$$parseOpera11(M){var N=M.stack.split('\n').filter(function(O){return!!O.match(J)&&!O.match(/^Error created at/)},this);return N.map(function(O){var P=O.split('@'),Q=this.extractLocation(P.pop()),R=P.shift()||'',S=R.replace(/<anonymous function(: (\w+))?>/,'$2').replace(/\([^\)]*\)/g,'')||void 0,T;R.match(/\(([^\)]*)\)/)&&(T=R.replace(/^[^\(]+\(([^\)]*)\)$/,'$1'));var U=T===void 0||'[arguments not available]'===T?void 0:T.split(',');return new I({functionName:S,args:U,fileName:Q[0],lineNumber:Q[1],columnNumber:Q[2],source:O})},this)}}})}),t={atLeastOne:function atLeastOne(G){const H=Object.keys(G);H.some((I)=>G[I]!==void 0)||throwError('Please set at least one of the following parameters: '+H.map((I)=>`'${I}'`).join(', '))},hasMethod:function hasMethod(G,H){const I=Object.keys(G).pop(),J=typeof G[I][H];'function'!=J&&throwError(`The '${I}' parameter must be an object that exposes a | ||
'${H}' method.`)},isInstance:function isInstance(G,H){const I=Object.keys(G).pop();G[I]instanceof H||throwError(`The '${I}' parameter must be an instance of | ||
'${H.name}'`)},isOneOf:function isOneOf(G,H){const I=Object.keys(G).pop();H.includes(G[I])||throwError(`The '${I}' parameter must be set to one of the | ||
following: ${H}`)},isType:function isType(G,H){const I=Object.keys(G).pop(),J=typeof G[I];J!==H&&throwError(`The '${I}' parameter has the wrong type. (Expected: | ||
${H}, actual: ${J})`)},isSWEnv:function isSWEnv(){return'ServiceWorkerGlobalScope'in self&&self instanceof ServiceWorkerGlobalScope},isValue:function isValue(G,H){const I=Object.keys(G).pop(),J=G[I];J!==H&&throwError(`The '${I}' parameter has the wrong value. (Expected: | ||
${H}, actual: ${J})`)},isArrayOfType:function isArrayOfType(G,H){const I=Object.keys(G).pop(),J=`The '${I}' parameter should be an array containing | ||
one or more '${H}' elements.`;Array.isArray(G[I])||throwError(J);for(let K of G[I])typeof K!==H&&throwError(J)},isArrayOfClass:function isArrayOfClass(G,H){const I=Object.keys(G).pop(),J=`The '${I}' parameter should be an array containing | ||
one or more '${H.name}' instances.`;Array.isArray(G[I])||throwError(J);for(let K of G[I])K instanceof H||throwError(J)}};let u='bgQueueSyncDB';var w=createCommonjsModule(function(G){'use strict';(function(){function toArray(I){return Array.prototype.slice.call(I)}function promisifyRequest(I){return new Promise(function(J,K){I.onsuccess=function(){J(I.result)},I.onerror=function(){K(I.error)}})}function promisifyRequestCall(I,J,K){var L,M=new Promise(function(N,O){L=I[J].apply(I,K),promisifyRequest(L).then(N,O)});return M.request=L,M}function promisifyCursorRequestCall(I,J,K){var L=promisifyRequestCall(I,J,K);return L.then(function(M){return M?new Cursor(M,L.request):void 0})}function proxyProperties(I,J,K){K.forEach(function(L){Object.defineProperty(I.prototype,L,{get:function(){return this[J][L]},set:function(M){this[J][L]=M}})})}function proxyRequestMethods(I,J,K,L){L.forEach(function(M){M in K.prototype&&(I.prototype[M]=function(){return promisifyRequestCall(this[J],M,arguments)})})}function proxyMethods(I,J,K,L){L.forEach(function(M){M in K.prototype&&(I.prototype[M]=function(){return this[J][M].apply(this[J],arguments)})})}function proxyCursorRequestMethods(I,J,K,L){L.forEach(function(M){M in K.prototype&&(I.prototype[M]=function(){return promisifyCursorRequestCall(this[J],M,arguments)})})}function Index(I){this._index=I}function Cursor(I,J){this._cursor=I,this._request=J}function ObjectStore(I){this._store=I}function Transaction(I){this._tx=I,this.complete=new Promise(function(J,K){I.oncomplete=function(){J()},I.onerror=function(){K(I.error)},I.onabort=function(){K(I.error)}})}function UpgradeDB(I,J,K){this._db=I,this.oldVersion=J,this.transaction=new Transaction(K)}function DB(I){this._db=I}proxyProperties(Index,'_index',['name','keyPath','multiEntry','unique']),proxyRequestMethods(Index,'_index',IDBIndex,['get','getKey','getAll','getAllKeys','count']),proxyCursorRequestMethods(Index,'_index',IDBIndex,['openCursor','openKeyCursor']),proxyProperties(Cursor,'_cursor',['direction','key','primaryKey','value']),proxyRequestMethods(Cursor,'_cursor',IDBCursor,['update','delete']),['advance','continue','continuePrimaryKey'].forEach(function(I){I in IDBCursor.prototype&&(Cursor.prototype[I]=function(){var J=this,K=arguments;return Promise.resolve().then(function(){return J._cursor[I].apply(J._cursor,K),promisifyRequest(J._request).then(function(L){return L?new Cursor(L,J._request):void 0})})})}),ObjectStore.prototype.createIndex=function(){return new Index(this._store.createIndex.apply(this._store,arguments))},ObjectStore.prototype.index=function(){return new Index(this._store.index.apply(this._store,arguments))},proxyProperties(ObjectStore,'_store',['name','keyPath','indexNames','autoIncrement']),proxyRequestMethods(ObjectStore,'_store',IDBObjectStore,['put','add','delete','clear','get','getAll','getKey','getAllKeys','count']),proxyCursorRequestMethods(ObjectStore,'_store',IDBObjectStore,['openCursor','openKeyCursor']),proxyMethods(ObjectStore,'_store',IDBObjectStore,['deleteIndex']),Transaction.prototype.objectStore=function(){return new ObjectStore(this._tx.objectStore.apply(this._tx,arguments))},proxyProperties(Transaction,'_tx',['objectStoreNames','mode']),proxyMethods(Transaction,'_tx',IDBTransaction,['abort']),UpgradeDB.prototype.createObjectStore=function(){return new ObjectStore(this._db.createObjectStore.apply(this._db,arguments))},proxyProperties(UpgradeDB,'_db',['name','version','objectStoreNames']),proxyMethods(UpgradeDB,'_db',IDBDatabase,['deleteObjectStore','close']),DB.prototype.transaction=function(){return new Transaction(this._db.transaction.apply(this._db,arguments))},proxyProperties(DB,'_db',['name','version','objectStoreNames']),proxyMethods(DB,'_db',IDBDatabase,['close']),['openCursor','openKeyCursor'].forEach(function(I){[ObjectStore,Index].forEach(function(J){J.prototype[I.replace('open','iterate')]=function(){var K=toArray(arguments),L=K[K.length-1],M=this._store||this._index,N=M[I].apply(M,K.slice(0,-1));N.onsuccess=function(){L(N.result)}}})}),[Index,ObjectStore].forEach(function(I){I.prototype.getAll||(I.prototype.getAll=function(J,K){var L=this,M=[];return new Promise(function(N){L.iterateCursor(J,function(O){return O?(M.push(O.value),void 0!==K&&M.length==K?void N(M):void O.continue()):void N(M)})})})});G.exports={open:function(I,J,K){var L=promisifyRequestCall(indexedDB,'open',[I,J]),M=L.request;return M.onupgradeneeded=function(N){K&&K(new UpgradeDB(M.result,N.oldVersion,M.transaction))},L.then(function(N){return new DB(N)})},delete:function(I){return promisifyRequestCall(indexedDB,'deleteDatabase',[I])}}})()});class IDBHelper{constructor(G,H,I){if(G==void 0||H==void 0||I==void 0)throw Error('name, version, storeName must be passed to the constructor.');this._name=G,this._version=H,this._storeName=I}_getDb(){return this._dbPromise?this._dbPromise:(this._dbPromise=w.open(this._name,this._version,(G)=>{G.createObjectStore(this._storeName)}).then((G)=>{return G}),this._dbPromise)}close(){return this._dbPromise?this._dbPromise.then((G)=>{G.close(),this._dbPromise=null}):void 0}put(G,H){return this._getDb().then((I)=>{const J=I.transaction(this._storeName,'readwrite'),K=J.objectStore(this._storeName);return K.put(H,G),J.complete})}delete(G){return this._getDb().then((H)=>{const I=H.transaction(this._storeName,'readwrite'),J=I.objectStore(this._storeName);return J.delete(G),I.complete})}get(G){return this._getDb().then((H)=>{return H.transaction(this._storeName).objectStore(this._storeName).get(G)})}getAllValues(){return this._getDb().then((G)=>{return G.transaction(this._storeName).objectStore(this._storeName).getAll()})}getAllKeys(){return this._getDb().then((G)=>{return G.transaction(this._storeName).objectStore(this._storeName).getAllKeys()})}}var x=function(G){return function(){var H=G.apply(this,arguments);return new Promise(function(I,J){function step(K,L){try{var M=H[K](L),N=M.value}catch(O){return void J(O)}return M.done?void I(N):Promise.resolve(N).then(function(O){step('next',O)},function(O){step('throw',O)})}return step('next')})}};let y=(()=>{var G=x(function*({hash:H,idbObject:I,response:J,idbQDb:K}){I.response={headers:JSON.stringify([...J.headers]),status:J.status,body:yield J.blob()},K.put(H,I)});return function putResponse(){return G.apply(this,arguments)}})(),z=(()=>{var G=x(function*({id:H}){const I=new IDBHelper(getDbName(),1,'QueueStore'),J=yield I.get(H);return J&&J.response?J.response:null});return function getResponse(){return G.apply(this,arguments)}})(),A=(()=>{var G=x(function*({request:H,config:I}){let J={config:I,metadata:{creationTimestamp:Date.now()},request:{url:H.url,headers:JSON.stringify([...H.headers]),mode:H.mode,method:H.method,redirect:H.redirect,credentials:H.credentials}};const K=yield H.text();return 0<K.length&&(J.request.body=K),J});return function getQueueableRequest(){return G.apply(this,arguments)}})(),B=(()=>{var G=x(function*({idbRequestObject:H}){let I={mode:H.mode,method:H.method,redirect:H.redirect,headers:new Headers(JSON.parse(H.headers)),credentials:H.credentials};return H.body&&(I.body=H.body),new Request(H.url,I)});return function getFetchableRequest(){return G.apply(this,arguments)}})(),C=(()=>{var G=x(function*(){let H=new IDBHelper(getDbName(),1,'QueueStore'),I=yield H.get(m);return I?void(yield Promise.all(I.map((()=>{var J=x(function*(K){const L=yield H.get(K);let M=[],N=[];yield Promise.all(L.map((()=>{var O=x(function*(P){const Q=yield H.get(P);Q&&Q.metadata&&Q.metadata.creationTimestamp+Q.config.maxAge<=Date.now()?N.push(H.delete(P)):M.push(P)});return function(){return O.apply(this,arguments)}})())),yield Promise.all(N),H.put(K,M)});return function(){return J.apply(this,arguments)}})()))):null});return function cleanupQueue(){return G.apply(this,arguments)}})();class RequestManager{constructor({callbacks:G,queue:H}){this._globalCallbacks=G||{},this._queue=H,this.attachSyncHandler()}attachSyncHandler(){self.addEventListener('sync',(G)=>{(G.tag===h+this._queue.queueName||G.tag==='SW_BACKGROUND_QUEUE_TAG_REPLAY')&&G.waitUntil(this.replayRequests())})}replayRequests(){var G=this;return this._queue.queue.reduce((H,I)=>{return H.then((()=>{var J=x(function*(){const L=yield G._queue.getRequestFromQueue({hash:I});if(!L.response){const M=yield B({idbRequestObject:L.request});return fetch(M).then(function(N){return N.ok?void(y({hash:I,idbObject:L,response:N.clone(),idbQDb:G._queue.idbQDb}),G._globalCallbacks.onResponse&&G._globalCallbacks.onResponse(I,N)):Promise.resolve()}).catch(function(N){G._globalCallbacks.onRetryFailure&&G._globalCallbacks.onRetryFailure(I,N)})}});return function(){return J.apply(this,arguments)}})())},Promise.resolve())}}let D=0,E=0;class RequestQueue{constructor({config:G,queueName:J='DEFAULT_QUEUE'+'_'+E++,idbQDb:H,broadcastChannel:I}){this._isQueueNameAddedToAllQueue=!1,this._queueName=J,this._config=G,this._idbQDb=H,this._broadcastChannel=I,this._queue=[],this.initQueue()}initQueue(){var G=this;return x(function*(){const H=yield G._idbQDb.get(G._queueName);G._queue.concat(H)})()}addQueueNameToAllQueues(){var G=this;return x(function*(){if(!G._isQueueNameAddedToAllQueue){let H=yield G._idbQDb.get(m);H=H||[],H.includes(G._queueName)||H.push(G._queueName),G._idbQDb.put(m,H),G._isQueueNameAddedToAllQueue=!0}})()}saveQueue(){var G=this;return x(function*(){yield G._idbQDb.put(G._queueName,G._queue)})()}push({request:G}){var H=this;return x(function*(){t.isInstance({request:G},Request);const I=`${G.url}!${Date.now()}!${D++}`,J=yield A({request:G,config:H._config});try{H._queue.push(I),H.saveQueue(),H._idbQDb.put(I,J),yield H.addQueueNameToAllQueues(),self.registration&&self.registration.sync.register(h+H._queueName),broadcastMessage({broadcastChannel:H._broadcastChannel,type:'BACKGROUND_REQUESTED_ADDED',id:I,url:G.url})}catch(K){broadcastMessage({broadcastChannel:H._broadcastChannel,type:'BACKGROUND_REQUESTED_FAILED',id:I,url:G.url})}})()}getRequestFromQueue({hash:G}){var H=this;return x(function*(){if(t.isType({hash:G},'string'),H._queue.includes(G))return yield H._idbQDb.get(G)})()}get queue(){return Object.assign([],this._queue)}get queueName(){return this._queueName}get idbQDb(){return this._idbQDb}}let F=(()=>{var G=x(function*({dbName:H}={}){H&&(t.isType({dbName:H},'string'),setDbName(H)),yield C()});return function initialize(){return G.apply(this,arguments)}})();a.initialize=F,a.getResponse=z,a.BackgroundSyncQueue=class BackgroundSyncQueue{constructor({maxRetentionTime:J=432000000,callbacks:G,queueName:H,broadcastChannel:I}={}){H&&t.isType({queueName:H},'string'),J&&t.isType({maxRetentionTime:J},'number'),I&&t.isInstance({broadcastChannel:I},BroadcastChannel),this._queue=new RequestQueue({config:{maxAge:J},queueName:H,idbQDb:new IDBHelper(getDbName(),1,'QueueStore'),broadcastChannel:I}),this._requestManager=new RequestManager({callbacks:G,queue:this._queue})}pushIntoQueue({request:G}){return t.isInstance({request:G},Request),this._queue.push({request:G})}fetchDidFail({request:G}){return this.pushIntoQueue({request:G})}},Object.defineProperty(a,'__esModule',{value:!0})}); | ||
//# sourceMappingURL=background-sync-queue.min.js.map |
@@ -29,2 +29,3 @@ /* | ||
const allQueuesPlaceholder = 'QUEUES'; | ||
const replayAllQueuesTag = 'SW_BACKGROUND_QUEUE_TAG_REPLAY'; | ||
@@ -1096,3 +1097,3 @@ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
self.addEventListener('sync', event => { | ||
if (event.tag === tagNamePrefix + this._queue.queueName) { | ||
if (event.tag === tagNamePrefix + this._queue.queueName || event.tag === replayAllQueuesTag) { | ||
event.waitUntil(this.replayRequests()); | ||
@@ -1099,0 +1100,0 @@ } |
@@ -29,2 +29,3 @@ /* | ||
const allQueuesPlaceholder = 'QUEUES'; | ||
const replayAllQueuesTag = 'SW_BACKGROUND_QUEUE_TAG_REPLAY'; | ||
@@ -39,2 +40,3 @@ exports.maxAge = maxAge; | ||
exports.allQueuesPlaceholder = allQueuesPlaceholder; | ||
exports.replayAllQueuesTag = replayAllQueuesTag; | ||
@@ -41,0 +43,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -22,2 +22,3 @@ /* | ||
const tagNamePrefix = 'SW_BACKGROUND_QUEUE_TAG_'; | ||
const replayAllQueuesTag = 'SW_BACKGROUND_QUEUE_TAG_REPLAY'; | ||
@@ -793,3 +794,3 @@ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
self.addEventListener('sync', event => { | ||
if (event.tag === tagNamePrefix + this._queue.queueName) { | ||
if (event.tag === tagNamePrefix + this._queue.queueName || event.tag === replayAllQueuesTag) { | ||
event.waitUntil(this.replayRequests()); | ||
@@ -796,0 +797,0 @@ } |
@@ -29,2 +29,3 @@ /* | ||
const allQueuesPlaceholder = 'QUEUES'; | ||
const replayAllQueuesTag = 'SW_BACKGROUND_QUEUE_TAG_REPLAY'; | ||
@@ -1189,3 +1190,3 @@ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
self.addEventListener('sync', event => { | ||
if (event.tag === tagNamePrefix + this._queue.queueName) { | ||
if (event.tag === tagNamePrefix + this._queue.queueName || event.tag === replayAllQueuesTag) { | ||
event.waitUntil(this.replayRequests()); | ||
@@ -1192,0 +1193,0 @@ } |
{ | ||
"name": "sw-background-sync-queue", | ||
"version": "0.0.16", | ||
"version": "0.0.18", | ||
"description": "Queues failed requests and uses the Background Sync API to replay those requests at a later time when the network state has changed.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
# sw-background-sync-queue | ||
<!-- DO NOT EDIT. This page is autogenerated. --># sw-background-sync-queue | ||
@@ -3,0 +3,0 @@ Queues failed requests and uses the Background Sync API to replay those requests at a later time when the network state has changed. |
@@ -9,2 +9,3 @@ const maxAge = 5*24*60*60*1000; // 5days | ||
const allQueuesPlaceholder = 'QUEUES'; | ||
const replayAllQueuesTag = 'SW_BACKGROUND_QUEUE_TAG_REPLAY'; | ||
export { | ||
@@ -19,2 +20,3 @@ maxAge, | ||
allQueuesPlaceholder, | ||
replayAllQueuesTag, | ||
}; |
import {putResponse} from './response-manager'; | ||
import {getFetchableRequest} from './queue-utils'; | ||
import {tagNamePrefix} from './constants'; | ||
import {tagNamePrefix, replayAllQueuesTag} from './constants'; | ||
@@ -37,3 +37,4 @@ /** | ||
self.addEventListener('sync', (event) => { | ||
if(event.tag === tagNamePrefix + this._queue.queueName) { | ||
if(event.tag === tagNamePrefix + this._queue.queueName | ||
|| event.tag === replayAllQueuesTag) { | ||
event.waitUntil(this.replayRequests()); | ||
@@ -40,0 +41,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
578826
10994