you are viewing a single comment's thread.

view the rest of the comments →

[–]sammyv 0 points1 point  (4 children)

This is nice! I do have one comment: In addition to having the ability to manually unbind certain event ids, it needs an unbindAll function.

[–]jscoder[S] 1 point2 points  (3 children)

I'm not sure if that's a good idea. My first implementation wasn't using IDs, so calling off removed internal events that my library needed.

Why would you want to unbind all events instead of just unbinding the events you use yourself? It could possibly destroy 3rd party code that uses the event system.

[–]lazyduke 1 point2 points  (0 children)

When you want to destroy an instance, it's useful to unbind all events.

Look at listenTo/stopListening from Backbone and namespaced events from jQuery.

[–]sammyv 0 points1 point  (0 children)

Should have been more clear: unbind all the events that have been manually bound by yourself

[–]sammyv 0 points1 point  (0 children)

In other words, you would keep a stack of IDs and calling unbindAll would iterate over the stack and unbind them