Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrepolischuk/wait-for-online
Wait for a browser to be online
https://github.com/andrepolischuk/wait-for-online
navigator online wait
Last synced: about 1 month ago
JSON representation
Wait for a browser to be online
- Host: GitHub
- URL: https://github.com/andrepolischuk/wait-for-online
- Owner: andrepolischuk
- License: mit
- Created: 2017-10-11T16:13:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-11T16:23:54.000Z (over 7 years ago)
- Last Synced: 2024-11-09T10:35:08.732Z (3 months ago)
- Topics: navigator, online, wait
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wait-for-online [![Build Status][travis-image]][travis-url]
> Wait for a browser to be online
Good for the chain of promises or `async`/`await`.
## Install
```sh
npm install --save wait-for-online
```## Usage
```js
import waitForOnline from 'wait-for-online'async function send (data) {
await waitForOnline()
await sendToApi(data)
}send({foo: 1})
```## API
### waitForOnline([timeout])
Returns a promise that resolves, when browser will be online.
#### timeout
Type: `number`
Default: `Infinity`Waiting timeout.
## License
MIT
[travis-url]: https://travis-ci.org/andrepolischuk/wait-for-online
[travis-image]: https://travis-ci.org/andrepolischuk/wait-for-online.svg?branch=master