JSFiddle - React, Tailwind, and code Playground
TypeScript
class Test(){
constructor(){
this.method1WasCalled = false;
this.method2WasCalled = false
}
method1(){
this.method1WasCalled = true;
this.callIfMethod1And2WasCalled();
}
method2(){
this.method2WasCalled = true;
this.callIfMethod1And2WasCalled();
}
callIfMethod1And2WasCalled(){
if (this.method1WasCalled && this.method2WasCalled) {
this.finalMethod();
}
}
finalMethod(){
alert('call final method');
}
}