jwerle / inverted-promise

When you want to resolve/reject a promise from the outside

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inverted-promise

Build Status

When you want to resolve/reject a promise from the outside

Usage

var InvertedPromise = require('inverted-promise')

var iP = new InvertedPromise()

var iP2 = new InvertedPromise()

iP.then((value) => {
  console.log(value)
})

iP2.catch((err) => {
  console.log(err)
})

iP.resolve('Hello')
iP2.reject('World')

API

const ip = new InvertedPromise([resolver])

Create a new InvertedPromise

ip.resolve(value)

Resolve the promise

ip.reject(error)

Reject the promise

Install

npm install inverted-promise

License

ISC

About

When you want to resolve/reject a promise from the outside

License:ISC License


Languages

Language:JavaScript 100.0%