0

I try hard to get a fluent interface with asynchronous functions. I have something like that:

class aClass {

    async asyncFuntionA() {
        await new Promise(resolve => {
            setTimeout(resolve, 100);
        })
        console.log('Funcion A')
    }
    async asyncFuntionB() {
        await new Promise(resolve => {
            setTimeout(resolve, 300);
        })
        console.log('Funcion B')
    }
}

Now I want to call them like that:

var test = new aClass();
test.asyncFuntionB().asyncFuntionA()

or

var test = new aClass();
test.funtionB().funtionA()

where functionA and functionB are some synchronous functions which need to achieve my goal for the asynchronous functions.

peni4142
  • 426
  • 1
  • 7
  • 26

0 Answers0