Skip to content

Instantly share code, notes, and snippets.

@r17x
Created February 18, 2019 13:49
Show Gist options
  • Select an option

  • Save r17x/d7d65b6d995d54133b1392a78a289300 to your computer and use it in GitHub Desktop.

Select an option

Save r17x/d7d65b6d995d54133b1392a78a289300 to your computer and use it in GitHub Desktop.

How to check service worker has installed in your browser

const z = await navigator.serviceWorker.getRegistrations() // return array Of [ServiceWorkerRegistration]
/***
[{
active: ServiceWorker {scriptURL: "http://localhost:5000/service-worker.js", state: "activated", onerror: null, onstatechange: ƒ}
installing: null
navigationPreload: NavigationPreloadManager {}
onupdatefound: ƒ ()
paymentManager: PaymentManager {instruments: PaymentInstruments, userHint: ""}
pushManager: PushManager {}
scope: "http://localhost:5000/"
sync: SyncManager {}
updateViaCache: "imports"
waiting: null
__proto__: ServiceWorkerRegistration
}]
***/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment