Service worker helper elements.
⚠️ This Element is now deprecated in favor of workbox and sw-toolbox ⚠️
sw-toolbox library.sw-import.js abstracts away many of the details of working with service workers,In order to use , it's recommended that you create a sw-import.js file in
your site's web root. The file's only contents should be
importScripts('bower_components/platinum-sw/service-worker.js');
You can adjust the path to service-worker.js if your project has its Polymer elements
installed somewhere other than bower_components/.
If you have multiple subdirectories worth of pages on your site, it's recommend that you include the element on a top-level entry page that all visitors will access first; once
they visit the top-level page and the service worker is registered, it will automatically apply to
all sub-pages, which will fall under its
scope.
sw-toolbox-setup.js script via a relative path, and that will fail when the elements are moved by and hardcode a base URI to use.cacheOnly & cacheFirst defaultCacheStrategy Considered Harmfulsw-toolbox library, is built on, supports a number ofcacheOnly and cacheFirst, are strongly discouraged to be used as the defaultCacheStrategy. With both of those strategies, all HTTP requests, including requests for element, are served directly from the Cache StorageIn a future release of , using cacheOnly and cacheFirst as defaultCacheStrategy
may lead to an explicit error condition, but for the meantime, please consider a more reasonable default
(like networkFirst).