Permalink
Browse files

yield: Don't remove the event handler unless its our event.

  • Loading branch information...
1 parent d321cbc commit 5a8edb9dbe3d7a803cc32be7213a99989d4b8550 @ChiperSoft committed Aug 5, 2011
Showing with 5 additions and 3 deletions.
  1. +4 −2 timed.js
  2. +1 −1 timed.min.js
View
@@ -99,8 +99,10 @@
//uses the postMessage feature when available. postMessage events fire before the timeout loop triggers
var wrapper, id = Math.round(Math.random()*1000000);
window.addEventListener('message', wrapper = function (event) {
- window.removeEventListener('message', wrapper);
- if (event.data === id) callback();
+ if (event.data === id) {
+ window.removeEventListener('message', wrapper);
+ callback();
+ }
});
window.postMessage(id, '*');
} else {
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 5a8edb9

Please sign in to comment.