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

Fix for problem with unbinding events inside cb#30

Merged
hay merged 1 commit into
hay:masterfrom
wellcaffeinated:patch-2
Feb 8, 2013
Merged

Fix for problem with unbinding events inside cb#30
hay merged 1 commit into
hay:masterfrom
wellcaffeinated:patch-2

Conversation

@wellcaffeinated

Copy link
Copy Markdown
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

hay commented Feb 8, 2013

Copy link
Copy Markdown
Owner

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
Copy Markdown
Contributor Author

Good call. (pun intended)

@hay

hay commented Feb 9, 2013

Copy link
Copy Markdown
Owner

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