client-sw-ready-event
v3.4.0
Published
Client Side service worker ready event
Downloads
27
Readme
Client Side Service Worker Ready Event
Intended to be used with sw-stream to register a service worker and provide the active service worker on a ready event
Usage
const SWcontroller = require('client-sw-ready-event/lib/sw-client.js')
const SwStream = require('sw-stream/lib/sw-stream.js')
const background = new SWcontroller({
fileName: '/service-worker.js',
// optional
scope: '/',
})
background.on('ready', () => {
let swStream = SwStream({
serviceWorker: background.controller,
})
// do stuff
})
background.startWorker()