Get started - Service worker plugin
Service worker plugin
Install
v.usePlugin() method.require('valyrian.js');
let Sw = require('valyrian.js/plugins/sw.js');
v.usePlugin(Sw);Use
If it's called without any params, it defaults to register
./sw.js file with{scope: '/'} options passed to the navigator.serviceWorker.register method.It returns a Promise that resolves with the service worker object.
// v.sw(file = './sw.js', options = {scope: '/'})
if (!v.isNode){
v.sw()
.then(console.log)
.catch(console.log);
}If you use server-side renderign remember to first validate that you are in a browser environment before call this method.