ws-async-base
v1.0.2
Published
a base class for delayable-async class in ES5(ES6 better) for javascript and typescript.
Downloads
5
Readme
Asyncable class base : Delay in your custom class as sync-syntax is enabled.
install this package:
npm install ws-async-base
Use it
First, make extends for your custom class:
export class MyClass extends AsyncableClassBase {
// ......
}
Then, you and wait in your code like this:
testFuct = async () => {
// DO work 01
await this.Delay(50);
// DO work 02 ......
}
Or you and wait in your code like this:
testFuct = async () => {
await this.DoAndWait(()=>{
console.log('I am your father!');
}, 5000);
console.log('hhhhhh');
}
testFuct = async () => {
await this.WaitAndDo(()=>{
console.log('I am your mother!');
}, 5000);
console.log('hhhhhh');
}
It's easy.