serviceworker-helpers

WebJar for serviceworker-helpers

License

License

MIT
GroupId

GroupId

org.webjars.bowergithub.morbidick
ArtifactId

ArtifactId

serviceworker-helpers
Last Version

Last Version

2.0.6
Release Date

Release Date

Type

Type

jar
Description

Description

serviceworker-helpers
WebJar for serviceworker-helpers
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/morbidick/serviceworker-helpers

Download serviceworker-helpers

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.morbidick/serviceworker-helpers/ -->
<dependency>
    <groupId>org.webjars.bowergithub.morbidick</groupId>
    <artifactId>serviceworker-helpers</artifactId>
    <version>2.0.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.morbidick/serviceworker-helpers/
implementation 'org.webjars.bowergithub.morbidick:serviceworker-helpers:2.0.6'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.morbidick/serviceworker-helpers/
implementation ("org.webjars.bowergithub.morbidick:serviceworker-helpers:2.0.6")
'org.webjars.bowergithub.morbidick:serviceworker-helpers:jar:2.0.6'
<dependency org="org.webjars.bowergithub.morbidick" name="serviceworker-helpers" rev="2.0.6">
  <artifact name="serviceworker-helpers" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.morbidick', module='serviceworker-helpers', version='2.0.6')
)
libraryDependencies += "org.webjars.bowergithub.morbidick" % "serviceworker-helpers" % "2.0.6"
[org.webjars.bowergithub.morbidick/serviceworker-helpers "2.0.6"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-toast jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

Polymer 2 components to work with Service Workers

Published on webcomponents.org Build Status

HowTo

Register service worker

Since its more or less a one-liner to register your service worker and included in most boilerplates there is no specific element.

<script>
  if ('serviceWorker' in navigator) {
    window.addEventListener('load', function() {
      navigator.serviceWorker.register('/service-worker.js');
    });
  }
</script>

<sw-update-toast>

Displays a toast requesting the user to reload the page when a source code update is available.

The update message can be overwriten by setting message (optional). The display time can be changed by setting duration, defaults to 0 / persistend.

<link rel="import" href="serviceworker-helpers/sw-update-toast.html">

<sw-update-toast
  message="My message"
  duration="5"
></sw-update-toast>

Change the link color by setting the css var --primary-color.

Development

# Get dependencies
$ npm install

# Demo site
$ npm start

# Run tests
$ npm test

Versions

Version
2.0.6