Package Exports
- wait.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wait.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Wait.js
Javascript library to easily delay and chain functions.
Installation
npm i wait.js --save
Usage
Plug wait.js
into your class:
import Wait from 'wait.js'
export default class MyClass {
constructor () {
this.waitter = new Wait()
}
wait (milliseconds = 0) {
this.waitter.handle(() => { /* Your code here */ }, milliseconds)
return this
}
foo () {
this.waitter.handle(() => { /* Your code here */ })
return this
}
bar () {
this.waitter.handle(() => { /* Your code here */ })
return this
}
}
It just works! You can now chain and delay your class methods:
const myclass = new MyClass()
myclass
.foo()
.wait(2000)
.bar()
.wait(500)
.bar()
.foo()
.wait(1000)
.bar()
// ..
License
MIT © 2017 Sylvain Simao