Каков синтаксис использования методов call()
или apply()
для изменения this
при работе с async
функциями?
В качестве примера:
class Foo {
async someLongMethod(){
... Do stuff
}
}
class Bar {
async someOtherMethodThatWillWait(){
//Will the following work?
await Foo.prototype.someLongMethod.call(this);
... Do stuff but only after someLongMethod has completed
}
}