Fix for problem with unbinding events inside cb #30

Merged
merged 1 commit into from Feb 8, 2013

Projects

None yet

2 participants

@wellcaffeinated
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.

@wellcaffeinated wellcaffeinated Fix for problem with unbinding events inside cb
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.
c301625
@hay hay merged commit 0a9c480 into hay:master Feb 8, 2013
@hay
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 hay added a commit that referenced this pull request Feb 8, 2013
@hay little update for #30 bf0b8ba
@wellcaffeinated
Contributor

Good call. (pun intended)

@hay
Owner
hay commented Feb 9, 2013

Lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment