Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventDispatcher does not implement an unbind method #12

Closed
leggetter opened this issue Nov 3, 2011 · 7 comments
Closed

EventDispatcher does not implement an unbind method #12

leggetter opened this issue Nov 3, 2011 · 7 comments

Comments

@leggetter
Copy link
Contributor

This has been raised a few times so it would be good to have this added to the EventDispatcher object:
https://github.com/pusher/pusher-js/blob/master/src/pusher_event_dispatcher.js

@myoung8
Copy link

myoung8 commented Nov 4, 2011

+1

 EventsDispatcher.prototype.unbind = function(event_name, callback) {
   var index = this.callbacks[event_name].indexOf(callback)
   this.callbacks[event_name].splice(index, 1)
   return this;// chainable
};

@ruudk
Copy link

ruudk commented Nov 18, 2011

+1 for this

@lopezdonaque
Copy link

+1!! It's very important to allow unbind when some component is destroyed.

For example, using ExtJS:

cmp.mon( pusher_channel, 'event_name', callback );

@rmw
Copy link

rmw commented Dec 10, 2011

+1!

When is the 1.10.0 release slated for?

@leggetter
Copy link
Contributor Author

1.10 has been release but the unbind addition was missed out. We've a pull request with older browser support (that don't support Array.indexOf) under review now.

@dmitry
Copy link

dmitry commented Jan 23, 2012

🆙

@leggetter
Copy link
Contributor Author

Version 1.11 of the Pusher JavaScript library now implements the unbind function. The hosted version of the library is available here:

You can see the implementation here:
https://github.com/pusher/pusher-js/blob/master/src/pusher_event_dispatcher.js#L30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants