Wait.js
🖇️ JavaScript library to easily delay and chain class functions.
Installation
npm i wait.js --save
Usage
Plug wait.js
into your class:
// step-1. Instantiate Wait.js and return "this" from your constructor: { thisw = return this } // step-2. Encapsulate each chainable function into the .handle() function: { return thisw } { return thisw } // step-3. Add a .pause() feature to your class: { return thisw } // step-4. It just works! You can now chain and delay your class functions:const c = c
Async functions
Wait.js also provides the ability to deal with async functions, by manually triggering the next execution:
//.. { // step-1. Add a "done" parameter to the encapsulating function // step-2. Manually call .done() when your async function is done return thisw } //.. // step-3. It just works! You can now chain and delay async functions:const c = c
Contribution
npm run watchnpm run test
License
MIT © 2017 Sylvain Simao