Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@converse/openpromise

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@converse/openpromise

An open promise is a promise which can be resolved or rejected outside of its closure

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
368
increased by12.88%
Maintainers
2
Weekly downloads
 
Created
Source

openpromise

JavaScript promises require that you call reject or resolve inside the closure of the created promise.

For example:


    const promise = new Promise((resolve, reject) => {
        // We have to call resolve or reject here, inside the closure
    });

    // We can't resolve the promise here, outside of the closure

This package lets you create an open promise. This is a normal JavaScript Promise, but with its resolve and reject callbacks set as attributes on the promise itself.

This lets you resolve or reject the promise outside of its closure.

For example:

    import { getOpenPromise } from 'openpromise';

    const promise = getOpenPromise();
    const func = setTimeout(() => promise.resolve(), 1000);
    return promise;

Keywords

FAQs

Package last updated on 27 Apr 2021

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