{"id":21916873,"url":"https://github.com/zenoo/offline-handler","last_synced_at":"2025-03-22T09:41:00.241Z","repository":{"id":51866458,"uuid":"159333497","full_name":"Zenoo/offline-handler","owner":"Zenoo","description":"Allow your users to use your website while offline easily","archived":false,"fork":false,"pushed_at":"2021-05-09T10:32:45.000Z","size":510,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T10:51:38.956Z","etag":null,"topics":["offline","offline-app","service-worker"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zenoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-27T12:40:09.000Z","updated_at":"2021-03-31T07:11:23.000Z","dependencies_parsed_at":"2022-09-20T23:20:14.570Z","dependency_job_id":null,"html_url":"https://github.com/Zenoo/offline-handler","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zenoo%2Foffline-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zenoo%2Foffline-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zenoo%2Foffline-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zenoo%2Foffline-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zenoo","download_url":"https://codeload.github.com/Zenoo/offline-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937740,"owners_count":20535124,"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":["offline","offline-app","service-worker"],"created_at":"2024-11-28T19:21:16.932Z","updated_at":"2025-03-22T09:41:00.219Z","avatar_url":"https://github.com/Zenoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OfflineHandler [(Demo)](https://zenoo.github.io/offline-app-example/)\n\nAllow your users to use your website while offline easily\n\n### Doc\n\n* **Installation**\n\nSimply import `OfflineHandler.min.js` into your HTML **and** download \u003ca href=\"https://raw.githubusercontent.com/Zenoo/offline-handler/master/OfflineHandler-sw.min.js\" target=\"_blank\"\u003e`OfflineHandler-sw.min.js`\u003c/a\u003e **at the root of your project**.\n```\n\u003cscript src=\"https://unpkg.com/offline-handler@0.4.1/OfflineHandler.min.js\"\u003e\u003c/script\u003e\t\n```\n* **How to use**\n\n  * Create a new [`OfflineHandler`](https://zenoo.github.io/offline-handler/OfflineHandler.html) object with the ressources to be cached as the first parameter :\n    ```\n    let ajax = new OfflineHandler(['path/to/customFile.js'], ...);\n    ```  \n    \n  * Call your URLs with an additional parameter : `?v=1`, or without any to get the default version.  \n    Changing this parameter will create a new cache version.  \n\tCalling your URLs with `?v=no-cache` will bypass the cached versions\n\n* **Parameters**\n\n```\n\t/**\n\t * List of ressources to be cached\n\t * The current page is always cached, no need to add it here\n\t * @type {String[]}\n\t */\n\tconst ressourceList = [\n\t\t'path/to/customFile.js',\n\t\t'pathto/the/customCss.css'\n\t];\n\n\t/**\n\t *  /|\\ OPTIONAL /|\\\n\t * Path to the OfflineHandler ServiceWorker file\n\t * @type {String}\n\t * @default OfflineHandler-sw.min.js\n\t */\n\tconst serviceWorkerPath = 'OfflineHandler-sw.min.js';\n\n\t/**\n\t *  /|\\ OPTIONAL /|\\\n\t * Name of the URL parameter that holds the version of the files\n\t * @type {String}\n\t * @default v\n\t */\n\tconst versionParameter = 'v';\n\n\t/**\n\t *  /|\\ OPTIONAL /|\\\n\t * Should the old cached versions be deleted when a new one is created ?\n\t * @type {Boolean}\n\t * @default false\n\t */\n\tconst clearOldCache = false;\n\n\t/**\n\t *  /|\\ OPTIONAL /|\\\n\t * Should external requests be cached ?\n\t * @type {Boolean}\n\t * @default false\n\t */\n\tconst cacheExternalRequests = false;\n\n\tnew OfflineHandler(ressourceList, serviceWorkerPath, versionParameter, clearOldCache, cacheExternalRequests);\n```\n\n* **Example**\n\nSee this [Github project](https://github.com/Zenoo/offline-app-example) for a working example.\n\n## Authors\n\n* **Zenoo** - *Initial work* - [Zenoo.fr](https://zenoo.fr)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenoo%2Foffline-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenoo%2Foffline-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenoo%2Foffline-handler/lists"}