workbox-background-sync
Advanced tools
Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3
@@ -6,3 +6,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self.workbox.v['workbox:background-sync:3.0.0-alpha.2'] = 1; | ||
self.workbox.v['workbox:background-sync:3.0.0-alpha.3'] = 1; | ||
} catch (e) {} // eslint-disable-line | ||
@@ -9,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){"use strict";try{self.workbox.v["workbox:background-sync:3.0.0-alpha.2"]=1}catch(e){}const r=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive","signal"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};"GET"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}}class i{constructor(e){this.t=e,this.r=new t.DBWrapper("workbox-background-sync",1,{onupgradeneeded:e=>e.target.result.createObjectStore("requests",{autoIncrement:!0}).createIndex("queueName","queueName",{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add("requests",{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching("requests",{index:"queueName",query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete("requests",t.primaryKey),new s(t.value.storableRequest)})()}}const n=new Set;class u{constructor(t,{callbacks:r={},maxRetentionTime:s=6048e5}={}){if(n.has(t))throw new e.WorkboxError("duplicate-queue-name",{name:t});n.add(t),this.s=t,this.i=r,this.n=s,this.u=new i(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.l("requestWillEnqueue",r),yield t.u.addEntry(r),yield t.a()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=Date.now(),r=[],s=[];let i;for(;i=yield e.u.getAndRemoveOldestEntry();){if(t-i.timestamp>e.n)continue;yield e.l("requestWillReplay",i);const n={request:i.toRequest()};try{n.response=yield fetch(n.request.clone())}catch(e){n.error=e,s.push(i)}r.push(n)}s.length&&(yield Promise.all(s.map(function(t){return e.u.addEntry(t)})),yield e.a()),yield e.l("queueDidReplay",r)})()}l(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){"function"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){"sync"in registration?self.addEventListener("sync",e=>{e.waitUntil(this.replayRequests())}):this.replayRequests()}a(){var e=this;return babelHelpers.asyncToGenerator(function*(){try{yield registration.sync.register(`workbox-background-sync:${e.s}`)}catch(e){}})()}static get o(){return n}}class c{constructor(...e){this.t=new u(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}return Object.freeze({Queue:u,Plugin:c})}(workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){"use strict";try{self.workbox.v["workbox:background-sync:3.0.0-alpha.3"]=1}catch(e){}const r=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive","signal"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};"GET"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}}class i{constructor(e){this.t=e,this.r=new t.DBWrapper("workbox-background-sync",1,{onupgradeneeded:e=>e.target.result.createObjectStore("requests",{autoIncrement:!0}).createIndex("queueName","queueName",{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add("requests",{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching("requests",{index:"queueName",query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete("requests",t.primaryKey),new s(t.value.storableRequest)})()}}const n=new Set;class u{constructor(t,{callbacks:r={},maxRetentionTime:s=6048e5}={}){if(n.has(t))throw new e.WorkboxError("duplicate-queue-name",{name:t});n.add(t),this.s=t,this.i=r,this.n=s,this.u=new i(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.l("requestWillEnqueue",r),yield t.u.addEntry(r),yield t.a()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=Date.now(),r=[],s=[];let i;for(;i=yield e.u.getAndRemoveOldestEntry();){if(t-i.timestamp>e.n)continue;yield e.l("requestWillReplay",i);const n={request:i.toRequest()};try{n.response=yield fetch(n.request.clone())}catch(e){n.error=e,s.push(i)}r.push(n)}s.length&&(yield Promise.all(s.map(function(t){return e.u.addEntry(t)})),yield e.a()),yield e.l("queueDidReplay",r)})()}l(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){"function"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){"sync"in registration?self.addEventListener("sync",e=>{e.waitUntil(this.replayRequests())}):this.replayRequests()}a(){var e=this;return babelHelpers.asyncToGenerator(function*(){try{yield registration.sync.register(`workbox-background-sync:${e.s}`)}catch(e){}})()}static get o(){return n}}class c{constructor(...e){this.t=new u(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}return Object.freeze({Queue:u,Plugin:c})}(workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-background-sync.prod.js.map |
{ | ||
"name": "workbox-background-sync", | ||
"version": "3.0.0-alpha.2", | ||
"version": "3.0.0-alpha.3", | ||
"license": "Apache-2.0", | ||
@@ -30,4 +30,4 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^3.0.0-alpha.2" | ||
"workbox-core": "^3.0.0-alpha.3" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134501
Updatedworkbox-core@^3.0.0-alpha.3