New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wait-for-es7

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wait-for-es7

WaitFor - util function which is waiting for some condition (`checkFn`) during `timeout`, checks it every `interval`. Rejects if condition not fulfilled.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
decreased by-4.55%
Maintainers
1
Weekly downloads
 
Created
Source

wait-for-es7

WaitFor - util function which is waiting for some condition (checkFn) during timeout, checks it every interval. Rejects if condition not fulfilled.

NPM version Build Status Dependency Status Coverage percentage experimental

Install

npm install wait-for-es7 --save

or

yarn add wait-for-es7

Usage

import waitFor from "wait-for-es6";

const startTime = new Date().getTime();

await waitFor( () => startTime < new Date().getTime() - 4000, { timeout: 5000, interval: 500 } );
// Not rejected, because 4000ms < 5000ms

await waitFor( () => false, { timeout: 5000, interval: 500 } );
// Will reject, because checkFn always return false

API

async function waitFor(checkFn: () => boolean | Promise<boolean>, options: IWaitForOptions = {});

interface IWaitForOptions {
    timeout?: number;
    interval?: number;
}

Test

npm install
npm test

FAQs

Package last updated on 16 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc