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

Bind callback passed to custom events to the node context #429

Merged
merged 1 commit into from
Apr 2, 2017

Conversation

Conduitry
Copy link
Member

Fixes #428

@Rich-Harris
Copy link
Member

My thinking here was that binding the callback has a performance and memory cost, which could become apparent if you had a very large number of event handlers — you need to create and hold n copies of the function in memory rather than just 1. But it is a little confusing (I've caught myself out that way) and I just realised the documentation gives the wrong advice. So, yeah.

Occurs to me that we could determine at compile time whether or not the callback needs to be bound by seeing whether or not the handler references any data (or this). I'll open a separate issue for that.

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.

2 participants