22
how to turn events on and off in Javascript
(lemmy.ml)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
You need a reference to your Eventhandler. So instead of just giving an anonymous callback function to your
addEventHandler
store it in a variable instead. Then your can callremoveEventHandler
with the same event type and the variable of your Eventhandler you want to remove.