1.1.1 • Published 11 months ago

sw-service v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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-service

Usage

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:unit

License

MIT

Acknowledgments

@TODOS

  • Write the tests
  • Improve the docs

Deployment

Install dependencies:

$ npm install

Build the library:

$ npm start

Publish to npm:

$ npm publish
1.1.1

11 months ago

1.1.0

12 months ago

1.0.0

1 year ago