Skip to content

@vite-pwa/workbox-swkit/core ​

Package

Declaration: @vite-pwa/workbox-swkit/core

Function Summary ​

NameDescription
clientsClaim Claim any currently available clients once the service worker becomes active. This is normally used in conjunction with skipWaiting().
copyResponse Allows developers to copy a response and modify its headers, status, or statusText values (the values settable via a [ResponseInit]https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#Syntax object in the constructor). To modify these values, pass a function as the second argument. That function will be invoked with a single object with the response properties {headers, status, statusText}. The return value of this function will be used as the ResponseInit for the new Response. To change the values either modify the passed parameter(s) and return it, or return a totally new object.
registerQuotaErrorCallback Adds a function to the set of quotaErrorCallbacks that will be executed if there's a quota error.
setCacheNameDetails Modifies the default cache names used by the Workbox packages. Cache names are generated as <prefix>-<Cache Name>-<suffix>.
skipWaiting This method is deprecated, and will be removed in Workbox v7.

Interface Summary ​

TypeDescription
CacheDidUpdateCallback
CacheDidUpdateCallbackParam
CachedResponseWillBeUsedCallback
CachedResponseWillBeUsedCallbackParam
CacheKeyWillBeUsedCallback
CacheKeyWillBeUsedCallbackParam
CacheWillUpdateCallback
CacheWillUpdateCallbackParam
FetchDidFailCallback
FetchDidFailCallbackParam
FetchDidSucceedCallback
FetchDidSucceedCallbackParam
HandlerDidCompleteCallback
HandlerDidCompleteCallbackParam
HandlerDidErrorCallback
HandlerDidErrorCallbackParam
HandlerDidRespondCallback
HandlerDidRespondCallbackParam
HandlerWillRespondCallback
HandlerWillRespondCallbackParam
HandlerWillStartCallback
HandlerWillStartCallbackParam
ManualHandlerCallback The "handler" callback is invoked whenever a Router matches a URL/Request to a Route via its RouteMatchCallback. This handler callback should return a Promise that resolves with a Response.
ManualHandlerCallbackOptions Options passed to a ManualHandlerCallback function.
MapLikeObject
RequestWillFetchCallback
RequestWillFetchCallbackParam
RouteHandlerCallback The "handler" callback is invoked whenever a Router matches a URL/Request to a Route via its RouteMatchCallback. This handler callback should return a Promise that resolves with a Response.
RouteHandlerCallbackOptions Options passed to a RouteHandlerCallback function.
RouteHandlerObject An object with a handle method of type RouteHandlerCallback.
RouteMatchCallback The "match" callback is used to determine if a Route should apply for a particular URL and request. When matching occurs in response to a fetch event from the client, the event object is also supplied. However, since the match callback can be invoked outside of a fetch event, matching logic should not assume the event object will always be available. If the match callback returns a truthy value, the matching route's RouteHandlerCallback will be invoked immediately. If the value returned is a non-empty array or object, that value will be set on the handler's options.params argument.
RouteMatchCallbackOptions Options passed to a RouteMatchCallback function.
WorkboxPlugin An object with optional lifecycle callback properties for the fetch and cache operations.
WorkboxPluginCallbackParam

Type Alias Summary ​

NameDescription
HandlerCallbackOptions
PluginState Using a plain MapLikeObject for now, but could extend/restrict this in the future.
RouteHandler Either a RouteHandlerCallback or a RouteHandlerObject. Most APIs in workbox-routing that accept route handlers take either.

Variable Summary ​

NameDescription
cacheNames Get the current cache names and prefix/suffix used by Workbox.

Released under the MIT License.