@the-/util-sw
Utility for service workers
Installation
$ npm install @the-/util-sw --save
Usage
'use strict'
const { appCache, cachingFetch } = require('@the-/util-sw')
async function tryExample() {
self.addEventListener('fetch', (event) => {
event.respondWith(
(async function() {
const cache = await appCache('my-site', 'v1.0.0')
return cachingFetch(cache, event.request)
})(),
)
})
}
tryExample().catch((err) => console.error(err))
API Guide
See API Guide for more detail
License
This software is released under the MIT License.