This content has been marked as final. Show 5 replies
Can you simplify the issue you're having to a single, runnable application file?
Are you meaning that you do not understand and being confused by too many lines of code? In this case, here is a simplified version of code.
But remember, I am not looking for the effect solution but for the solution to pass more than one arguments when using the addEventListener (such as the reference to an object created dynamically).
Ah, ok, I get it now. Here's info on passing more than one arg with an event listener:
Because the second parameter of addEventListener() is a function, you cannot specify parameters of that function in the addEventListener() call. So, to pass additional parameters to the listener function, you must define them in the listener function and then call the final method with those parameters.
Full text is here:
Thank you very much! This is very useful when playing with dynamic component.
When using an anonymous function as the listener in this way, be aware that there's no way to manually remove the event listener with that syntax. You could try to create a weak listener and hope that the garbage collector will remove it for you, but be aware of this issue when creating components dynamically.