promise-then
v0.1.1
Published
Promises/A+ implementation
Downloads
1
Maintainers
Readme
Promises/A+ implementation based on observer pattern. Promises/A+ speciation
is a kind of typical solution for asynchronous flow control. All promise instance is a kind of observer's subject and all callback functions are observers of the above subject.
Installation
# using yarn
yarn add promise-then
# using npm
npm i promise-then
Usage
import Promiser from 'promise-then'
const promiser = new Promiser((resolve, reject) => {
// ... omit unrelated code
resolve(result) // or reject(reason)
})
promiser.then(
result => {
/* get `result` from promiser internal */
},
reason => {
/* handle any error in the promiser */
}
)
Debug mode
Debug mode only works with Visual Studio Code breakpoint.
# using yarn
yarn run debug
# using npm
npm run debug