workbox-strategies
Advanced tools
Comparing version 5.0.0-alpha.2 to 5.0.0-beta.0
// @ts-ignore | ||
try { | ||
self['workbox:strategies:5.0.0-alpha.2'] && _(); | ||
self['workbox:strategies:5.0.0-beta.0'] && _(); | ||
} | ||
catch (e) { } |
@@ -7,3 +7,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self['workbox:strategies:5.0.0-alpha.2'] && _(); | ||
self['workbox:strategies:5.0.0-beta.0'] && _(); | ||
} catch (e) {} | ||
@@ -10,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(t,e,s,i,r){"use strict";try{self["workbox:strategies:5.0.0-alpha.2"]&&_()}catch(t){}class n{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){let i,n=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!n)try{n=await this.o(e,t)}catch(t){i=t}if(!n)throw new r.WorkboxError("no-response",{url:e.url,error:i});return n}async o(t,e){const r=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),n=r.clone(),h=s.cacheWrapper.put({cacheName:this.t,request:t,response:n,event:e,plugins:this.s});if(e)try{e.waitUntil(h)}catch(t){}return r}}class h{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.h=t.matchOptions}async handle({event:t,request:e}){const i=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!i)throw new r.WorkboxError("no-response",{url:e.url});return i}}const c={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};class a{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[c,...t.plugins]}else this.s=[c];this.u=t.networkTimeoutSeconds||0,this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const s=[],i=[];let n;if(this.u){const{id:r,promise:h}=this.l({request:e,event:t,logs:s});n=r,i.push(h)}const h=this.p({timeoutId:n,request:e,event:t,logs:s});i.push(h);let c=await Promise.race(i);if(c||(c=await h),!c)throw new r.WorkboxError("no-response",{url:e.url});return c}l({request:t,logs:e,event:s}){let i;return{promise:new Promise(e=>{i=setTimeout(async()=>{e(await this.v({request:t,event:s}))},1e3*this.u)}),id:i}}async p({timeoutId:t,request:e,logs:r,event:n}){let h,c;try{c=await i.fetchWrapper.fetch({request:e,event:n,fetchOptions:this.i,plugins:this.s})}catch(t){h=t}if(t&&clearTimeout(t),h||!c)c=await this.v({request:e,event:n});else{const t=c.clone(),i=s.cacheWrapper.put({cacheName:this.t,request:e,response:t,event:n,plugins:this.s});if(n)try{n.waitUntil(i)}catch(t){}}return c}v({event:t,request:e}){return s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s})}}class o{constructor(t={}){this.s=t.plugins||[],this.i=t.fetchOptions}async handle({event:t,request:e}){let s,n;try{n=await i.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.i,plugins:this.s})}catch(t){s=t}if(!n)throw new r.WorkboxError("no-response",{url:e.url,error:s});return n}}class u{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[c,...t.plugins]}else this.s=[c];this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const i=this.o({request:e,event:t});let n,h=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(h){if(t)try{t.waitUntil(i)}catch(n){}}else try{h=await i}catch(t){n=t}if(!h)throw new r.WorkboxError("no-response",{url:e.url,error:n});return h}async o({request:t,event:e}){const r=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),n=s.cacheWrapper.put({cacheName:this.t,request:t,response:r.clone(),event:e,plugins:this.s});if(e)try{e.waitUntil(n)}catch(t){}return r}}const l={cacheFirst:n,cacheOnly:h,networkFirst:a,networkOnly:o,staleWhileRevalidate:u},w=t=>{const e=l[t];return t=>new e(t)},p=w("cacheFirst"),v=w("cacheOnly"),m=w("networkFirst"),q=w("networkOnly"),y=w("staleWhileRevalidate");return t.CacheFirst=n,t.CacheOnly=h,t.NetworkFirst=a,t.NetworkOnly=o,t.StaleWhileRevalidate=u,t.cacheFirst=p,t.cacheOnly=v,t.networkFirst=m,t.networkOnly=q,t.staleWhileRevalidate=y,t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(t,e,s,i,r){"use strict";try{self["workbox:strategies:5.0.0-beta.0"]&&_()}catch(t){}class n{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){let i,n=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!n)try{n=await this.o(e,t)}catch(t){i=t}if(!n)throw new r.WorkboxError("no-response",{url:e.url,error:i});return n}async o(t,e){const r=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),n=r.clone(),h=s.cacheWrapper.put({cacheName:this.t,request:t,response:n,event:e,plugins:this.s});if(e)try{e.waitUntil(h)}catch(t){}return r}}class h{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.h=t.matchOptions}async handle({event:t,request:e}){const i=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!i)throw new r.WorkboxError("no-response",{url:e.url});return i}}const c={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};class a{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[c,...t.plugins]}else this.s=[c];this.u=t.networkTimeoutSeconds||0,this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const s=[],i=[];let n;if(this.u){const{id:r,promise:h}=this.l({request:e,event:t,logs:s});n=r,i.push(h)}const h=this.p({timeoutId:n,request:e,event:t,logs:s});i.push(h);let c=await Promise.race(i);if(c||(c=await h),!c)throw new r.WorkboxError("no-response",{url:e.url});return c}l({request:t,logs:e,event:s}){let i;return{promise:new Promise(e=>{i=setTimeout(async()=>{e(await this.v({request:t,event:s}))},1e3*this.u)}),id:i}}async p({timeoutId:t,request:e,logs:r,event:n}){let h,c;try{c=await i.fetchWrapper.fetch({request:e,event:n,fetchOptions:this.i,plugins:this.s})}catch(t){h=t}if(t&&clearTimeout(t),h||!c)c=await this.v({request:e,event:n});else{const t=c.clone(),i=s.cacheWrapper.put({cacheName:this.t,request:e,response:t,event:n,plugins:this.s});if(n)try{n.waitUntil(i)}catch(t){}}return c}v({event:t,request:e}){return s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s})}}class o{constructor(t={}){this.s=t.plugins||[],this.i=t.fetchOptions}async handle({event:t,request:e}){let s,n;try{n=await i.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.i,plugins:this.s})}catch(t){s=t}if(!n)throw new r.WorkboxError("no-response",{url:e.url,error:s});return n}}class u{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[c,...t.plugins]}else this.s=[c];this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const i=this.o({request:e,event:t});let n,h=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(h){if(t)try{t.waitUntil(i)}catch(n){}}else try{h=await i}catch(t){n=t}if(!h)throw new r.WorkboxError("no-response",{url:e.url,error:n});return h}async o({request:t,event:e}){const r=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),n=s.cacheWrapper.put({cacheName:this.t,request:t,response:r.clone(),event:e,plugins:this.s});if(e)try{e.waitUntil(n)}catch(t){}return r}}const l={cacheFirst:n,cacheOnly:h,networkFirst:a,networkOnly:o,staleWhileRevalidate:u},w=t=>{const e=l[t];return t=>new e(t)},p=w("cacheFirst"),v=w("cacheOnly"),m=w("networkFirst"),q=w("networkOnly"),y=w("staleWhileRevalidate");return t.CacheFirst=n,t.CacheOnly=h,t.NetworkFirst=a,t.NetworkOnly=o,t.StaleWhileRevalidate=u,t.cacheFirst=p,t.cacheOnly=v,t.networkFirst=m,t.networkOnly=q,t.staleWhileRevalidate=y,t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-strategies.prod.js.map |
@@ -1,2 +0,2 @@ | ||
import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import './_version.js'; | ||
@@ -22,3 +22,3 @@ interface CacheFirstOptions { | ||
*/ | ||
declare class CacheFirst implements RouteHandler { | ||
declare class CacheFirst implements RouteHandlerObject { | ||
private _cacheName; | ||
@@ -25,0 +25,0 @@ private _plugins; |
@@ -1,2 +0,2 @@ | ||
import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import './_version.js'; | ||
@@ -20,3 +20,3 @@ interface CacheOnlyOptions { | ||
*/ | ||
declare class CacheOnly implements RouteHandler { | ||
declare class CacheOnly implements RouteHandlerObject { | ||
private _cacheName; | ||
@@ -23,0 +23,0 @@ private _plugins; |
@@ -1,2 +0,2 @@ | ||
import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import './_version.js'; | ||
@@ -25,3 +25,3 @@ interface NetworkFirstOptions { | ||
*/ | ||
declare class NetworkFirst implements RouteHandler { | ||
declare class NetworkFirst implements RouteHandlerObject { | ||
private _cacheName; | ||
@@ -28,0 +28,0 @@ private _plugins; |
@@ -1,2 +0,2 @@ | ||
import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import './_version.js'; | ||
@@ -19,3 +19,3 @@ interface NetworkFirstOptions { | ||
*/ | ||
declare class NetworkOnly implements RouteHandler { | ||
declare class NetworkOnly implements RouteHandlerObject { | ||
private _plugins; | ||
@@ -22,0 +22,0 @@ private _fetchOptions?; |
{ | ||
"name": "workbox-strategies", | ||
"version": "5.0.0-alpha.2", | ||
"version": "5.0.0-beta.0", | ||
"license": "MIT", | ||
@@ -31,6 +31,6 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^5.0.0-alpha.2", | ||
"workbox-routing": "^5.0.0-alpha.2" | ||
"workbox-core": "^5.0.0-beta.0", | ||
"workbox-routing": "^5.0.0-beta.0" | ||
}, | ||
"gitHead": "0cb0029b692c3802545238fe59b6d6179ca32f6c" | ||
"gitHead": "136b38f2c701bd7c04e808d19961310a9ede524b" | ||
} |
// @ts-ignore | ||
try{self['workbox:strategies:5.0.0-alpha.2']&&_()}catch(e){} | ||
try{self['workbox:strategies:5.0.0-beta.0']&&_()}catch(e){} |
@@ -16,3 +16,3 @@ /* | ||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; | ||
import {RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {messages} from './utils/messages.js'; | ||
@@ -42,3 +42,3 @@ import './_version.js'; | ||
*/ | ||
class CacheFirst implements RouteHandler { | ||
class CacheFirst implements RouteHandlerObject { | ||
private _cacheName: string; | ||
@@ -45,0 +45,0 @@ private _plugins: WorkboxPlugin[]; |
@@ -14,3 +14,3 @@ /* | ||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; | ||
import {RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {messages} from './utils/messages.js'; | ||
@@ -38,3 +38,3 @@ import './_version.js'; | ||
*/ | ||
class CacheOnly implements RouteHandler { | ||
class CacheOnly implements RouteHandlerObject { | ||
private _cacheName: string; | ||
@@ -41,0 +41,0 @@ private _plugins: WorkboxPlugin[]; |
@@ -16,3 +16,3 @@ /* | ||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; | ||
import {RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {messages} from './utils/messages.js'; | ||
@@ -46,3 +46,3 @@ import {cacheOkAndOpaquePlugin} from './plugins/cacheOkAndOpaquePlugin.js'; | ||
*/ | ||
class NetworkFirst implements RouteHandler { | ||
class NetworkFirst implements RouteHandlerObject { | ||
private _cacheName: string; | ||
@@ -49,0 +49,0 @@ private _plugins: WorkboxPlugin[]; |
@@ -13,3 +13,3 @@ /* | ||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; | ||
import {RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {messages} from './utils/messages.js'; | ||
@@ -36,3 +36,3 @@ import './_version.js'; | ||
*/ | ||
class NetworkOnly implements RouteHandler { | ||
class NetworkOnly implements RouteHandlerObject { | ||
private _plugins: WorkboxPlugin[]; | ||
@@ -39,0 +39,0 @@ private _fetchOptions?: RequestInit; |
@@ -16,3 +16,3 @@ /* | ||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; | ||
import {RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin} from 'workbox-core/types.js'; | ||
import {messages} from './utils/messages.js'; | ||
@@ -50,3 +50,3 @@ import {cacheOkAndOpaquePlugin} from './plugins/cacheOkAndOpaquePlugin.js'; | ||
*/ | ||
class StaleWhileRevalidate implements RouteHandler { | ||
class StaleWhileRevalidate implements RouteHandlerObject { | ||
private _cacheName: string; | ||
@@ -53,0 +53,0 @@ private _plugins: WorkboxPlugin[]; |
@@ -1,2 +0,2 @@ | ||
import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
import './_version.js'; | ||
@@ -29,3 +29,3 @@ interface StaleWhileRevalidateOptions { | ||
*/ | ||
declare class StaleWhileRevalidate implements RouteHandler { | ||
declare class StaleWhileRevalidate implements RouteHandlerObject { | ||
private _cacheName; | ||
@@ -32,0 +32,0 @@ private _plugins; |
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
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
340261
Updatedworkbox-core@^5.0.0-beta.0