Service worker loader for choo. Only runs in the browser, and emits events.
Does not include the worker code itself, you'll need to serve it using a tool
like bankai
.
var choo = require('choo')
var app = choo()
if (process.env.NODE_ENV !== 'production') {
app.use(require('choo-service-worker/clear')())
}
app.use(require('choo-service-worker')())
app.mount('body')
Emitted if the worker fails to register.
Emitted when the worker correctly registers.
Register a new service worker if possible. Route defaults to /sw.js
. If
provided, opts
is passed directly to the worker register code. Emits events
when the worker is registered.
Clear all service workers.