This PR changes the way event listeners are registered on connect() for a better removal as per the recommendation in this manual.
When you call .bind() on a function, it creates a new function. Therefore, calling bind twice means the add and remove eventListeners are calling different references of the function and the event wont be removed. Make sure that when adding and removing event listeners you use the same bound function reference.
This PR changes the way event listeners are registered on
connect()
for a better removal as per the recommendation in this manual.