@the-/util-sw

15.5.3 • Public • Published

@the-/util-sw

npm Version

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.

Links

Readme

Keywords

Package Sidebar

Install

npm i @the-/util-sw

Weekly Downloads

1

Version

15.5.3

License

MIT

Unpacked Size

57 kB

Total Files

16

Last publish

Collaborators

  • okunishinishi