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

avoids jQuery's event system when binding on observes which fixes #280 #517

Merged
merged 1 commit into from
Oct 28, 2013

Conversation

justinbmeyer
Copy link
Contributor

This avoids jQuery's slowish event system for observes. It also adds can.listenTo and can.stopListening which work similar to backbone's methods of the same name.

justinbmeyer added a commit that referenced this pull request Oct 28, 2013
avoids jQuery's event system when binding on observes which fixes #280
@justinbmeyer justinbmeyer merged commit f3c8c29 into master Oct 28, 2013
@imjoshdean
Copy link
Contributor

I'd love to have another one of your 15-30 minute lunch sessions where you explain the performance gains we get from this.

@justinbmeyer
Copy link
Contributor Author

A session isn't likely necessary for this one.

jQuery does a lot of special things when registering an event listener: https://github.com/bitovi/canjs/blob/master/lib/jquery.1.9.1.js#L2721

For example, it handles special events, event delegation, namespaces, events on HTMLElements.

Our addEvent does far less:

https://github.com/bitovi/canjs/blob/master/util/event.js#L8

It basically pushes the handler on an array.

There's a LOT of event binding going on when you render 200 items in TodoMVC. It was the dominate part of the runtime. We replaced the observable event binding with something MUCH faster.

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

Successfully merging this pull request may close these issues.

None yet

2 participants