sw-puppeteer-helper
v1.0.0
Published
helper function to manage service worker in puppeteer
Downloads
1
Readme
sw-puppeteer-helper
Service Worker helper functions for Puppeteer
Usage
Register Service Worker
import { registerServiceWorker } from 'sw-puppeteer-helper';
// Register script to Puppeteer's page, return a Promise.
registerServiceWorker(page, 'http://localhost:3000/sw.js');
// Register script under certain scope, default is '/'
registerServiceWorker(page, 'http://localhost:3000/sw.js', '/foo');
Unregister Service Worker under certain scope
import { unregisterServiceWorker } from 'sw-puppeteer-helper';
// Unregister script under certain scope, default is '/'.
unregisterServiceWorker(page, '/foo');
Cleanup all Service Workers
import { cleanupServiceWorkers } from 'sw-puppeteer-helper';
// Unregister script under certain scope, default is '/'.
cleanupServiceWorkers(page);