{"id":29354436,"url":"https://github.com/googlechromelabs/sw-appcache-behavior","last_synced_at":"2025-07-09T03:14:45.542Z","repository":{"id":46520655,"uuid":"87836716","full_name":"GoogleChromeLabs/sw-appcache-behavior","owner":"GoogleChromeLabs","description":"A service worker implementation of the behavior defined in a page's AppCache manifest.","archived":false,"fork":false,"pushed_at":"2025-03-28T22:17:16.000Z","size":1796,"stargazers_count":54,"open_issues_count":22,"forks_count":12,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-06-25T08:49:44.423Z","etag":null,"topics":["appcache","service-worker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleChromeLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-10T17:08:29.000Z","updated_at":"2025-03-17T14:32:43.000Z","dependencies_parsed_at":"2024-05-01T22:22:28.468Z","dependency_job_id":null,"html_url":"https://github.com/GoogleChromeLabs/sw-appcache-behavior","commit_stats":{"total_commits":32,"total_committers":3,"mean_commits":"10.666666666666666","dds":0.21875,"last_synced_commit":"fb25968c9b5775796dbf367b20a8a122587ef21c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/GoogleChromeLabs/sw-appcache-behavior","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsw-appcache-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsw-appcache-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsw-appcache-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsw-appcache-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleChromeLabs","download_url":"https://codeload.github.com/GoogleChromeLabs/sw-appcache-behavior/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsw-appcache-behavior/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264384459,"owners_count":23599619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appcache","service-worker"],"created_at":"2025-07-09T03:14:44.853Z","updated_at":"2025-07-09T03:14:45.534Z","avatar_url":"https://github.com/GoogleChromeLabs.png","language":"TypeScript","readme":"## About\n\nA pair of modules meant to ease the transition\n[off of AppCache](https://alistapart.com/article/application-cache-is-a-douchebag/)\nand on to\n[service workers](https://developers.google.com/web/fundamentals/primers/service-workers/).\n\nNote: These libraries attempt to replicate the caching and serving behavior that AppCache offers, but does **not** include direct equivalents to the [`window.applicationCache` interface](https://developer.mozilla.org/en-US/docs/Web/API/Window/applicationCache), nor the related events that AppCache would fire in the `window` context.\n\n## Installation\n\nThere are two modules to install: one that is used from within the `window`\ncontext in your web app, and the other that's used in the context of your\nservice worker.\n\n```sh\nnpm install --save-dev appcache-polyfill-window\nnpm install --save-dev appcache-polyfill-sw\n```\n\nAs an alternative to local installation \u0026 serving, you can load both libraries from a NPM CDN, like https://unpkg.com/ or https://www.pika.dev/.\n\n## Usage\n\n### Window client\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {init} from '/path/to/appcache-polyfill-window/build/index.modern.js';\n\n  // Optional: define a callback that runs whenever caches are updated.\n  // This is *rough* replacement for listening for AppCache updates.\n  function myCachePopulatedCallback(urls) {\n    // urls is an array of updated URLs\n    // Your logic goes here.\n  }\n\n  init({\n    cachePopulatedCallback: myCachePopulatedCallback,\n  }).then(() =\u003e navigator.serviceWorker.register('sw.js'));\n\u003c/script\u003e\n```\n\n### Service worker client\n\n```js\nimportScripts('/path/to/appcache-polyfill-sw/build/index.umd.js');\n\nself.addEventListener('fetch', (event) =\u003e {\n  // Alternatively, examine event.request and only use the\n  // appcachePolyfill.handle() logic for a subset of requests.\n  event.respondWith(appcachePolyfill.handle(event));\n});\n```\n\n## Feedback\n\nPlease [open an issue](https://github.com/googlechromelabs/sw-appcache-behavior/issues) with feedback or bug reports if you run in to problems.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglechromelabs%2Fsw-appcache-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglechromelabs%2Fsw-appcache-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglechromelabs%2Fsw-appcache-behavior/lists"}