New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

controllable-promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

controllable-promise

Control when a JavaScript promise resolves or rejects.

latest
Source
npmnpm
Version
1.3.0
Version published
Maintainers
1
Created
Source

Controllable Promise

Control when a JavaScript promise resolves or rejects.

Getting started

npm i controllable-promise

Create the promise and manually invoke the resolve function:

import ControllablePromise from 'controllable-promise';

const setupPromise = new ControllablePromise()

setupPromise.then(() => {
    executeSomeAfterSetupLogic();
})

callSomeSetupLogic();

setupPromise.resolve();

Or use the promise as you would normally:

import ControllablePromise from 'controllable-promise';

const setupPromise = new ControllablePromise(resolve => {
    callSomeSetupLogic();

    // Below is optional, you can still manually invoke the `resolve`
    // later using `setupPromise.resolve()`
    resolve();
})

await setupPromise;

executeSomeAfterSetupLogic();

FAQs

Package last updated on 21 May 2022

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