Skip to content

A simple and powerful Promise lib that give to you capability to remote resolve/reject a promise.

License

Notifications You must be signed in to change notification settings

ovictoraurelio/promise-remotely

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promise-remotely

Create native ES6 promises that can be resolved or rejected externally.

A simple and powerful Promise package that give to you capability to remote resolve/reject a promise.

Getting Started

First of all install the package

npm i promise-remotely

Then import the package

import PromiseRemotely from  'promise-remotely'

Create a Instance of a remote promise

const sampleRemotePromise  =  PromiseRemotely()

To remotely solve the promise

sampleRemotePromise.resolve()

To remotely reject the promise

sampleRemotePromise.reject()

You can either pass a result object

sampleRemotePromise.resolve({  status:  200  })

How await the remote promise

const result = await sampleRemotePromise.promise