Socket
Book a DemoInstallSign in
Socket

timeout-idle-promise

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timeout-idle-promise

Detects when a promise is idle (does not create asynchronous events) for longer than permitted amount of time.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

timeout-idle-promise

Travis build status Coveralls NPM version Canonical Code Style Twitter Follow

Detects when a promise is idle (does not create asynchronous events) for longer than permitted amount of time.

API

import {
  timeoutIdlePromise,
  TimeoutError,
} from 'timeout-idle-promise';

/**
 * @param {Function} promiseFactory
 * @param {number} maximumIdleTime Idle timeout in milliseconds.
 * @throws TimeoutError
 */
timeoutIdlePromise(promiseFactory);

Example Usage

// Rejected with Idle promise timeout.
timeoutIdlePromise(() => {
  return new Promise((resolve) => {

  });
}, 1000);

// Resolved.
timeoutIdlePromise(() => {
  return new Promise((resolve) => {
    setTimeout(() => {
      setTimeout(() => {
        setTimeout(() => {
          resolve();
        }, 500);
      }, 500);
    }, 500);
  });
}, 1000);

Keywords

timeout

FAQs

Package last updated on 01 Nov 2019

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