sw-service v1.1.1
SW Service
The sw-service package streamlines the registration of Service Workers on client devices, simplifying the process of delivering enhanced functionality and offline capabilities through Progressive Web Apps. This package offers a user-friendly approach to managing PWA installations, providing a seamless experience for both developers and end users.
If you are looking for a tool to generate the Service Worker for your app, some options are: sw-builder and PWA Builder.
If your service worker is generated after the build process but you wish to test the registration flow during development, create an empty sw.js file and pass its path to the register method.
For an example on how to implement this package, visit uipalettes.
Getting Started
Install the package:
$ npm install -S sw-serviceUsage
Register the Service Worker:
SWService.register({
path: '/sw.js',
debugMode: true
});Trigger the PWA Installer:
if (SWService.installer?.canAppBeInstalled()) {
SWService.installer.installApp();
}Update the Service Worker and refresh the app:
SWService.updateApp();Built With
- TypeScript
Running the Tests
# E2E Tests
$ npm run test:e2e
# Integration Tests
$ npm run test:integration
# Unit Tests
$ npm run test:unitLicense
Acknowledgments
@TODOS
- Write the tests
- Improve the docs
Deployment
Install dependencies:
$ npm installBuild the library:
$ npm startPublish to npm:
$ npm publish