1.0.2 • Published 8 years ago

ws-async-base v1.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

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.