{"id":13397470,"url":"https://github.com/HubSpot/offline","last_synced_at":"2025-03-14T00:32:24.717Z","repository":{"id":37773772,"uuid":"13753838","full_name":"HubSpot/offline","owner":"HubSpot","description":"Automatically display online/offline indication to your users","archived":true,"fork":false,"pushed_at":"2023-02-26T00:19:50.000Z","size":1403,"stargazers_count":8638,"open_issues_count":119,"forks_count":844,"subscribers_count":339,"default_branch":"master","last_synced_at":"2025-03-11T15:12:17.230Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.hubspot.com/offline/docs/welcome","language":"CSS","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/HubSpot.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}},"created_at":"2013-10-21T20:14:57.000Z","updated_at":"2025-03-04T10:00:51.000Z","dependencies_parsed_at":"2022-08-19T09:50:14.702Z","dependency_job_id":"a6c244f5-0bb9-4bab-b55e-27dc232cd43a","html_url":"https://github.com/HubSpot/offline","commit_stats":{"total_commits":288,"total_committers":40,"mean_commits":7.2,"dds":0.6354166666666667,"last_synced_commit":"a17291864212aab9ae9325c7ce5a2e0f541e96bf"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Foffline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Foffline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Foffline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Foffline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubSpot","download_url":"https://codeload.github.com/HubSpot/offline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243062540,"owners_count":20230202,"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":[],"created_at":"2024-07-30T18:01:25.749Z","updated_at":"2025-03-14T00:32:23.702Z","avatar_url":"https://github.com/HubSpot.png","language":"CSS","funding_links":[],"categories":["CSS","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"___\n\n**This project isn't actively maintained.**\n___\n\nOffline\n======\n\n**Note to users pre-0.6.0:  Offline previously used a cloudfront hosted file as one of it's methods of detecting the connection status.  This method is now deprecated and the image has been removed.  Please upgrade to Offline 0.7.0+.**\n\nImprove the experience of your app when your users lose connection.\n\n- Monitors ajax requests looking for failure\n- Confirms the connection status by requesting an image or fake resource\n- Automatically grabs ajax requests made while the connection is down and remakes them\n  after the connection is restored.\n- Simple UI with beautiful themes\n- 3kb minified and compressed\n\nInstallation\n-------------------\n\nInclude [the javascript](https://raw.github.com/HubSpot/offline/v0.7.14/offline.min.js), one of [the themes](http://github.hubspot.com/offline/docs/welcome/), and one of [the\nlanguages](https://github.com/HubSpot/offline/tree/master/themes) on your site.  You're done!\n\nTo use only the JavaScript API without a UI indicator, simply leave out the CSS file.\n\nIf you'd like to get a peek at how it looks on your site, disconnect your internet, or try out the [simulator](http://craigshoemaker.github.io/offlinejs-simulate-ui/).\n\nAdvanced\n--------\n\nOptionally, you can provide some configuration by setting `Offline.options` after\nbringing in the script.\n\nOptions (any can be provided as a function), with their defaults:\n\n```javascript\n{\n  // Should we check the connection status immediatly on page load.\n  checkOnLoad: false,\n\n  // Should we monitor AJAX requests to help decide if we have a connection.\n  interceptRequests: true,\n\n  // Should we automatically retest periodically when the connection is down (set to false to disable).\n  reconnect: {\n    // How many seconds should we wait before rechecking.\n    initialDelay: 3,\n\n    // How long should we wait between retries.\n    delay: (1.5 * last delay, capped at 1 hour)\n  },\n\n  // Should we store and attempt to remake requests which fail while the connection is down.\n  requests: true,\n\n  // Should we show a snake game while the connection is down to keep the user entertained?\n  // It's not included in the normal build, you should bring in js/snake.js in addition to\n  // offline.min.js.\n  game: false\n}\n```\n\nProperties\n----------\n\n`Offline.check()`: Check the current status of the connection.\n\n`Offline.state`: The current state of the connection 'up' or 'down'\n\n`Offline.on(event, handler, context)`: Bind an event.  Events:\n\n  - up: The connection has gone from down to up\n  - down: The connection has gone from up to down\n  - confirmed-up: A connection test has succeeded, fired even if the connection was already up\n  - confirmed-down: A connection test has failed, fired even if the connection was already down\n  - checking: We are testing the connection\n  - reconnect:started: We are beginning the reconnect process\n  - reconnect:stopped: We are done attempting to reconnect\n  - reconnect:tick: Fired every second during a reconnect attempt, when a check is not happening\n  - reconnect:connecting: We are reconnecting now\n  - reconnect:failure: A reconnect check attempt failed\n  - requests:flush: Any pending requests have been remade\n  - requests:capture: A new request is being held\n\n`Offline.off(event, handler)`: Unbind an event\n\nChecking\n--------\n\nBy default, Offline makes an XHR request to load your `/favicon.ico` to check the connection.  If you don't\nhave such a file, it will 404 in the console, but otherwise work fine (even a 404 means the connection is up).\nYou can change the URL it hits (an endpoint which will respond with a quick 204 is perfect):\n\n```javascript\nOffline.options = {checks: {xhr: {url: '/connection-test'}}};\n```\n\nMake sure that the URL you check has the same origin as your page (the connection method, domain and port all must be the same), or you\nwill run into CORS issues.  You can add `Access-Control` headers to the endpoint to fix it on modern browsers, but it will still cause issues on\nIE9 and below.\n\nIf you do want to run tests on a different domain, try the image method.  It loads an image, which are allowed to cross domains.\n\n```javascript\nOffline.options = {checks: {image: {url: 'my-image.gif'}, active: 'image'}}\n```\n\nThe one caveat is that with the image method, we can't distinguish a 404 from a genuine connection issue, so any error at all will\nappear to Offline as a connection issue.\n\nOffline also includes a check called `'up'` and another called `'down'` which will always report being up or down respectively for\ntesting.  You can activate them by setting the `active` option, adding a data attribute to your script tag with the name\n`data-simulate` and value `'up'` or `'down'`, or by setting `localStorage.OFFLINE_SIMULATE` to `'up'` or `'down'`.\n\nReconnect\n---------\n\nThe reconnect module automatically retests the connection periodically when it is down.\nA successful AJAX request will also trigger a silent recheck (if `interceptRequests` is not false).\n\nYou can disable the reconnect module by setting the `reconnect` to false.  Reconnect can be\nconfigured by setting options on the reconnect setting.\n\nRequests\n--------\n\nThe requests module holds any failed AJAX requests and, after deduping them, remakes them when the connection\nis restored.\n\nYou can disable it by setting the `requests` setting to false.\n\nYou can also set deDupBody to be true if you want deduping to also take into account the content of the request.\n\nDependencies\n------------\n\nNone!\n\nBrowser Support\n---------------\n\nModern Chrome, Firefox, Safari and IE8+\n\nNote that not all browsers (including Safari and old IE) support the offline events, forcing Offline to use less accurate methods of detection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHubSpot%2Foffline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHubSpot%2Foffline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHubSpot%2Foffline/lists"}