trying to add / remove a callback to an event (e.g. afterchartrender) when there are parameters.
is there a way to do it?
i'm able to add a parameterized function as a callback using an anonymous function wrapper, but don't know how to use .off to remove that specific callback after.
is there a way? e.g. using .bind?
related, is there a way to get a list of all callbacks bound to a particular event?
thank you,
Hello, Michael!
Thank you for contacting us.
Kindly note that you can remove the specific callback by passing the function name to the off()
API call as follows:
const customCallbackHandler = (...) => {...};
flexmonster.off("afterchartdraw", customCallbackHandler);
Currently, Flexmonster does not provide a way to get a list of all callbacks bound to a particular event. However, it is possible to remove all callbacks of the event. This can be done by calling off()
without the second parameter:
flexmonster.off("afterchartdraw")
Here is a JSFiddle example for reference: https://jsfiddle.net/flexmonster/tygxsg5d/.
For more information, please look through our docs: https://www.flexmonster.com/api/off/.
We hope it helps. Feel free to contact us if any further questions arise.
Regards,
Solomiia
Hello, Michael!
Hope you are doing well.
Our team is wondering if you had a chance to try the suggested approach of removing a specific callback. Could you please let us know if it helps?
Looking forward to hearing from you.
Regards,
Solomiia
Hello, Michael!
Hope you are having a great week.
Just checking in to ask if the suggested approach was helpful.
Looking forward to your response.
Regards,
Solomiia