Skip to content

Instantly share code, notes, and snippets.

@nobuti
Last active June 20, 2020 06:17
Show Gist options
  • Save nobuti/f257838067aec25b88d52d87768f1cb3 to your computer and use it in GitHub Desktop.
Save nobuti/f257838067aec25b88d52d87768f1cb3 to your computer and use it in GitHub Desktop.
Service worker force update
forceSWupdate () {
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker.getRegistrations().then(function (registrations) {
      for (let registration of registrations) {
        registration.update()
      }
    })
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment