andrepolischuk / wait-for-online

Wait for a browser to be online

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Wait for a browser to be online

License:MIT License


Languages

Language:JavaScript 100.0%