Skip to content
This repository has been archived by the owner. 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

@wellcaffeinated wellcaffeinated commented Feb 7, 2013

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 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

@wellcaffeinated wellcaffeinated commented Feb 8, 2013

Good call. (pun intended)

@hay
Copy link
Owner

@hay hay commented Feb 9, 2013

Lol.

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.