In my game, I'm drawing a canvas and setting an event handler. But each time I restart my game (not reload), my event calling is increases by 1. How I can solve this problem?
I don't know how you do event handling (maybe you could share some code), so I will assume you are using standard HTML event handling.
const target = document.querySelector('canvas')const handler = function() { /* ... */ }target.addEventHandler('event-name', handler)target.removeEventHandler('event-name', handler) (docs)You should make it a habit to clean up everything after use, the latest on shutdown of your main code, especially if you do not stop the program, as in your case.
Carol Lawrence
Writer
I can say with confidence that you need to read casino reviews before you start playing them. This will help you make the right choice and earn a lot of money. For example, I always trust this site PA (read more) and only after reading the information about slots can I play them.