{"id":13517212,"url":"https://github.com/lukeed/is-offline","last_synced_at":"2025-10-09T18:23:33.321Z","repository":{"id":57277463,"uuid":"113522573","full_name":"lukeed/is-offline","owner":"lukeed","description":"A tiny (174B) library to detect `offline` status \u0026 respond to changes in the browser.","archived":false,"fork":false,"pushed_at":"2018-12-28T01:53:01.000Z","size":11,"stargazers_count":91,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-03T01:13:29.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jsfiddle.net/lukeed/8at2tg1e/","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/lukeed.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}},"created_at":"2017-12-08T02:40:24.000Z","updated_at":"2024-04-15T10:19:09.000Z","dependencies_parsed_at":"2022-09-18T15:31:18.337Z","dependency_job_id":null,"html_url":"https://github.com/lukeed/is-offline","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fis-offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fis-offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fis-offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fis-offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/is-offline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246433169,"owners_count":20776547,"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-08-01T05:01:31.177Z","updated_at":"2025-10-09T18:23:28.290Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# is-offline [![Build Status](https://travis-ci.org/lukeed/is-offline.svg?branch=master)](https://travis-ci.org/lukeed/is-offline)\n\n\u003e A tiny (174B) library to detect `offline` status \u0026 respond to changes in the browser.\n\nThis module exposes three module definitions:\n\n* **ES Module**: `dist/is-offline.es.js`\n* **CommonJS**: `dist/is-offline.js`\n* **UMD**: `dist/is-offline.min.js`\n\nIf using the UMD bundle, the library is exposed as `is-offline` globally.\n\n\n## Install\n\n```\n$ npm install --save is-offline\n```\n\n\n## Usage\n\n```js\nimport { check, watch } from 'is-offline';\n\nlet foobar = bool =\u003e console.log('Am I offline?', bool);\n\n// Check if currently offline\ncheck().then(foobar);\n\n// Setup a \"watcher\" to respond to all online/offline changes\nlet unwatch = watch(foobar);\n\n// The \"watcher\" will be active until it's deactivated\nunwatch();\n```\n\n## API\n\n### isOffline.check()\n\nReturns: `Promise`\n\nResolves a `Boolean` to indicate offline status. For clarity, `true` means that you are offline.\n\n### isOffline.watch(fn)\n\nReturns: `Function`\n\nReturns a function that is used to disable/unmount the event listeners.\n\n#### fn\n\nType: `Function`\n\nThe function to run whenever the network status changes. It receives a `Boolean` value, just like [`isOffline`](#isofflinecheck).\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fis-offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fis-offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fis-offline/lists"}