{"_id":"sw-cache-options","_rev":"306611","name":"sw-cache-options","description":"ServiceWorker CacheQueryOptions polyfill (ignoreSearch)","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"nekr","email":""}],"time":{"modified":"2021-06-03T19:33:34.000Z","created":"2016-03-01T21:12:12.752Z","1.0.0":"2016-03-01T21:12:12.752Z"},"users":{},"author":"","versions":{"1.0.0":{"name":"sw-cache-options","version":"1.0.0","description":"ServiceWorker CacheQueryOptions polyfill (ignoreSearch)","main":"lib/index.js","files":["lib/"],"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["serviceworker","service worker","polyfill","ignoreSearch","ignoreMethod","ignoreVary","CacheQueryOptions","cache"],"author":"","license":"MIT","devDependencies":{"babel-preset-es2015":"^6.5.0","del":"^2.2.0","gulp":"github:gulpjs/gulp#4.0","gulp-babel":"^6.1.2","gulp-rename":"^1.2.2"},"gitHead":"55e38b421a9e651b14bb663e001288e5acde6e52","_id":"sw-cache-options@1.0.0","_shasum":"24f20afc28ed66f431d3a7a356238be56e86bc84","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"nekr","email":"nekr.fabula@gmail.com"},"dist":{"shasum":"24f20afc28ed66f431d3a7a356238be56e86bc84","size":3440,"noattachment":false,"key":"/sw-cache-options/-/sw-cache-options-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sw-cache-options/download/sw-cache-options-1.0.0.tgz"},"maintainers":[{"name":"nekr","email":""}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/sw-cache-options-1.0.0.tgz_1456866730346_0.9796776534058154"},"directories":{},"publish_time":1456866732752,"_cnpm_publish_time":1456866732752,"_hasShrinkwrap":false}},"readme":"# ServiceWorker `CacheQueryOptions` polyfill\n\n## Install\n\n#### Webpack/Browserify/Whatever-bundler\n\n```\nnpm install -i sw-cache-options\n```\n\n#### Browser\n\n* Copy `dist/sw-cache-options.js` into your project\n* Load it inside ServiceWorker by `importScripts('sw-cache-options.js')`\n\n## Implementation\n\nThis is a polyfill for [`CacheQueryOptions`](https://www.w3.org/TR/service-workers/#cache-query-options-dictionary) of ServiceWorker. At a momemnt, Chrome (and its family) doesn't support it natively, so polyfill required. Chrome is sniffed by user agent, exactly this way:\n```\nconst isChrome = navigator.userAgent.indexOf('Chrome/') !== -1\n```\n\n* `ignoreSearch` is implemented for all methods which accepts it.\n* `ignoreMethod` is implemented for all methods which accepts it.\n* `ignoreVary` is **not** implemented. Reason is that it requires getting all responses (`Cache#matchAll()`), which might not be so bad, I do not want to deal with it a moment. Feel free to make a PR for it.\n\nBrowsers which support `CacheQueryOptions` nativily: Firefox.\n\n## Tests\n\nOpen https://rawgit.com/NekR/sw-cache-options/master/tests/index.html in target browser and open DevTools console, tests' resulsts are logged into it.\n\nTests can be run againt any browser with ServiceWorker support, since they check general support of `CacheQueryOptions`. However, polyfill is applied only in Chrome-family browsers, so for actuall results test there. To test in other browser:\n\n* Clone repository\n* Go to `src/index.js` and comment the line `if (!isChrome) return;`\n* Then run in command line `gulp build`\n* And startup server in repo directory, like this `http-server -p 7777 -c-1`\n* Open `localhost:7777/tests/index.html` and open DevTools console to see results\n\n## License\n\nMIT","_attachments":{},"license":"MIT"}