promise-cascade0.1.2 • Public • Published
Easy to use library for cascading promises. If you're looking for a way to use the response from one promise into another, this library is meant for you.
Designed while working on the Premiere Library, PromiseCascade thrives helping keep concerns separate in a clean manner.
npm install promise-cascade --save
stack: Stores pushed functions and arguments
push(fn: PromiseFunction, ...args: any): this: Pushes a function to the stack (this function must return a
play(): Promise<any>: Calls the pushed function with given args + callback
clear(): Removes all values from the
This examples are written in TypeScript. To use with ES6, just remove typings.
Pushing and Playing
;;;;.pushaddAwesomeness.pushgetName, 'John Doe'.play;promise.then;
Real World Example - Extending PromiseCascade
This is a simplified version of Premiere's
For more about how Promise works, check out Dave Atchley's article