I added two buttons to an entity, each of which is meant to run a different action. This is what I am using to test the connectivity:
When the page loads, this is what is printed to the console:
That makes sense and is what I expected to see. However, clicking either button results in the following output in the console:
I don't understand the point of the init functions if the classes are unable to store state. What am I doing wrong?
Code:
define(['action-handler'], (Dep) => {
return class extends Dep {
actionToRun = null
initAdjust() {
this.actionToRun = "adjust"
console.log("adjust", this.actionToRun)
}
initSetPaid() {
this.actionToRun = "setPaid"
console.log("setPaid", this.actionToRun)
}
async runAction() {
console.log("run action", this.actionToRun)
return
}
}
}
Code:
setPaid setPaid adjust adjust
Code:
run action null
