Created
November 27, 2011 16:36
-
-
Save user24/1397774 to your computer and use it in GitHub Desktop.
various code style options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handling = false; | |
window.onSomeEvent = function handleEvent() { | |
if(handling) return; | |
handling = true; | |
/* some other handler code here which eventually switches handling off again */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handling = false; | |
window.onSomeEvent = function handleEvent() { | |
handling ? return : handling = true; | |
/* some other handler code here which eventually switches handling off again */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handling = false; | |
window.onSomeEvent = function handleEvent() { | |
if(handling) { | |
return; | |
} | |
handling = true; | |
/* some other handler code here which eventually switches handling off again */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handling = false; | |
window.onSomeEvent = function handleEvent() { | |
if(handling) { | |
return; | |
} else { | |
handling = true; | |
/* some other handler code here which eventually switches handling off again */ | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Callback stacks? Can't you just use objects?