3 ms·
Was pretty confused at first about why this would have a Backbone dependency until I looked through the source and saw they they're just pulling Backbone.Events
by kevincennis 13y ago
Was pretty confused at first about why this would have a Backbone dependency until I looked through the source and saw they they're just pulling Backbone.Events.
I think it says a lot about Backbone that people are doing things like that. Modularity is nice.
Oh, and thumbs up for Two.js. Well done.
- jonobr1 13y agoThe decision for Backbone events vs other events is based on this performance review: http://jsperf.com/events-vs-events2/25 http://jsperf.com/events-vs-events2/25
- vec 13y agoThat's not a big surprise. jQuery's events use native browser events behind the scenes. Which is nice for dom-oriented plugins; you get bubbling for free and all the native event listeners just work. It's got a pretty fair amount of overhead though. Backbone's events are just a pure JS event emitter implementation. I'm curious, though, why they added an external dependency instead of just inlining a solution. There's a couple of good MIT licenced barebones implementations[1][2] floating around, and it's pretty straightforward to reimplement yourself in an hour or two if you prefer. [1] https://github.com/Wolfy87/EventEmitter https://github.com/Wolfy87/EventEmitter [2] https://github.com/hij1nx/EventEmitter2 https://github.com/hij1nx/EventEmitter2
- jonobr1 13y agoI was not aware of these other event systems in JavaScript. Thanks for pointing these out!
- imjared 13y agoJust to add to the list: https://github.com/necolas/emitter.js https://github.com/necolas/emitter.js :)
- ajacksified 13y agoOr http://github.com/ajacksified/Mediator.js http://github.com/ajacksified/Mediator.js :D
- ianstormtaylor 13y agoor https://github.com/component/emitter https://github.com/component/emitter if you wanted to get real modular and release the library as smaller Components.
- bfm 13y agoYou also have Backbone events extracted from Backbone on https://github.com/bermi/eventify https://github.com/bermi/eventify