Skip to content

Instantly share code, notes, and snippets.

@user24
Created November 27, 2011 16:36
Show Gist options
  • Save user24/1397774 to your computer and use it in GitHub Desktop.
Save user24/1397774 to your computer and use it in GitHub Desktop.
various code style options
var handling = false;
window.onSomeEvent = function handleEvent() {
if(handling) return;
handling = true;
/* some other handler code here which eventually switches handling off again */
};
var handling = false;
window.onSomeEvent = function handleEvent() {
handling ? return : handling = true;
/* some other handler code here which eventually switches handling off again */
};
var handling = false;
window.onSomeEvent = function handleEvent() {
if(handling) {
return;
}
handling = true;
/* some other handler code here which eventually switches handling off again */
};
var handling = false;
window.onSomeEvent = function handleEvent() {
if(handling) {
return;
} else {
handling = true;
/* some other handler code here which eventually switches handling off again */
}
};
@tcrayford
Copy link

Callback stacks? Can't you just use objects?

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