Open wz2b opened 3 years ago
As a workaround, I added something to ctrl like this:
// function onInit(ctrl, svgnode) {
ctrl.privateState = {
counter: 0
}
// }
// function onHandleMetric(ctrl, svgnode) {
console.log("The counter is now", ctrl.privateState.counter++)
// }
This works, but I feel like it's unsafe.
I have a feature request that I think would be non-breaking.
I would like .onInit() to be able to return an item - let's call it a state or context - that is then passed as a 2rd parameter to onHandleMetric() ... for example:
Some things can be done by re-selecting from the DOM but that's more expensive than just passing a reference to some objects you created, and it doesn't let you pass other things.
Does this seem reasonable?