Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created August 15, 2018 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/fc0fa978398cb7327ee59524333ed2f4 to your computer and use it in GitHub Desktop.
Save goofmint/fc0fa978398cb7327ee59524333ed2f4 to your computer and use it in GitHub Desktop.
const channel = new MessageChannel();
navigator.serviceWorker.controller
.postMessage({
action: 'cache',
url: 'http://www.example.com/app',
response: 'Hello World'
}, [channel.port2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment