I have noticed that using the "addEventListener" and coming back into a frame, I get multiple events tied to the same component.
The design I am using jumps to an "I" frame (intermediate) and then back to the "M" frame (main) when the user performs an action.
I add event listeners to several components when I enter that M frame. What I notice is that the events seem to stack up for a particular component.
For instance, if I enter M frame, N number of times and addEventListener("click", handleEvent) to a radio button, I get N calls to handleEvent when
the user clicks on the radio button. I guess this kinda makes sense but is not what I want. I just want one event of a particular type (in this case "click") to
be associated with the a particular component. I get around this issue by removing the event(s) in the I frame. Then they get reinstalled in the M frame. Only one at a time.
So, just wondering about this behaviour. Is there a way to check for the number of events that are currently active on a particular component? Better way to handle adding events?
use a boolean to add listeners once.