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

Support on/off events #461

Merged
merged 2 commits into from Nov 12, 2014

Conversation

Projects
None yet
3 participants
@raimohanska
Contributor

raimohanska commented Nov 7, 2014

Some libs (for example, codemirror) publish events using on/off methods instead of addListener/addEventListener/bind. It's easy to add support for those in Bacon.fromEventTarget.

Shall we?

@wolfflow

This comment has been minimized.

Show comment
Hide comment
@wolfflow

wolfflow Nov 7, 2014

Member

Thumbs up! I would purge .on/.off mess from my marionettejs code, replacing it with new handlers)

Member

wolfflow commented Nov 7, 2014

Thumbs up! I would purge .on/.off mess from my marionettejs code, replacing it with new handlers)

Show outdated Hide outdated src/Bacon.coffee
sub = target.addEventListener ? (target.addListener ? target.bind)
unsub = target.removeEventListener ? (target.removeListener ? target.unbind)
sub = target.addEventListener ? target.addListener ? target.bind ? target.on
unsub = target.removeEventListener ? target.removeListener ? target.unbind ? target.off ? target.off

This comment has been minimized.

@rpominov

rpominov Nov 7, 2014

double target.off %)

@rpominov

rpominov Nov 7, 2014

double target.off %)

This comment has been minimized.

@raimohanska

raimohanska Nov 7, 2014

Contributor

Oh, nicely spotted. Clearly a vim error :) Fixed in 94fb7e7

@raimohanska

raimohanska Nov 7, 2014

Contributor

Oh, nicely spotted. Clearly a vim error :) Fixed in 94fb7e7

@raimohanska raimohanska merged commit 9d622bc into master Nov 12, 2014

1 check was pending

continuous-integration/travis-ci The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment