wait-for-target
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

wait-for-target Build Status

Wait for a target is ready

Install

npm install --save wait-for-target

Usage

import waitForTarget from 'wait-for-target'

async function push (...args) {
  const analytics = await waitForTarget(() => window.ga)

  analytics('send', 'event', ...args)
}

push('ready')

API

waitForTarget(getTarget[, timeout])

Return a promise that resolves to target when ready.

getTarget

Type: function

Function returns a target for resolve.

timeout

Type: number
Default: Infinity

Waiting timeout.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i wait-for-target

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

3.98 kB

Total Files

5

Last publish

Collaborators

  • andrepolischuk