Skip to content
This repository has been archived by the owner on May 2, 2019. It is now read-only.

Fix for problem with unbinding events inside cb #30

Merged
merged 1 commit into from
Feb 8, 2013

Conversation

wellcaffeinated
Copy link
Contributor

When doing something like this:
.on('evt', function theCallback(data){
    this.off('evt', theCallback);
});

stapes will throw an error because the event handler array
is being modified as it is looping though.

This edit copies the array locally to fix this.

When doing something like this:
.on('evt', function theCallback(data){
    this.off('evt', theCallback);
});

stapes will throw an error because the event handler array 
is being modified as it is looping though.

This edit copies the array locally to fix this.
hay added a commit that referenced this pull request Feb 8, 2013
Fix for problem with unbinding events inside cb
@hay hay merged commit 0a9c480 into hay:master Feb 8, 2013
@hay
Copy link
Owner

hay commented Feb 8, 2013

Merged and will be in the next release. I've optimized the code a little bit (slice.call is cached). Thanks again for a patch Jasper!

hay added a commit that referenced this pull request Feb 8, 2013
@wellcaffeinated
Copy link
Contributor Author

Good call. (pun intended)

@hay
Copy link
Owner

hay commented Feb 9, 2013

Lol.

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

Successfully merging this pull request may close these issues.

2 participants