/wait-for-online

Wait for a browser to be online

Primary LanguageJavaScriptMIT LicenseMIT

wait-for-online Build Status

Wait for a browser to be online

Good for the chain of promises or async/await.

Install

npm install --save wait-for-online

Usage

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