Skip to content

Instantly share code, notes, and snippets.

@delapuente
Last active January 25, 2016 09:51
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 delapuente/f60ef0e877dbef4a7473 to your computer and use it in GitHub Desktop.
Save delapuente/f60ef0e877dbef4a7473 to your computer and use it in GitHub Desktop.
WordPress API extensions to support ServiceWorkers
// Enqueue API extension for the registration script
// This uses wp_enqueue_script() to register it with a well known name such as sw-registration:/path/to/scope
sw_enqueue_registration_script('/path/to/scope');
// Plugin 1
wp_enqueue_script('plugin-1-sw-setup', '/plugin1/js/manager.js', array('sw-registration:/path/to/scope'));
// Plugin 2
wp_enqueue_script('plugin-2-sw-setup', '/plugin2/js/manager.js', array('sw-registration:/path/to/scope'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment