detect-var
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

detect-var

Wait for any async injected variables. such as ethereum provider window.ethereum

Usage

import detectVar from 'detect-var'
const ethereum = await detectVar(() => window.ethereum)
console.log(ethereum === window.ethereum) // true

Parameter

detectVar(fn, [options])

  • fn: return the object to be detected
  • options
    • timeout: number maximum detection time, default 5000 ms
    • step: number interval between each detect, default 500 ms

Readme

Keywords

none

Package Sidebar

Install

npm i detect-var

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

2.65 kB

Total Files

4

Last publish

Collaborators

  • coffcer