Skip to content

Instantly share code, notes, and snippets.

@sarfraznawaz2005
Last active October 12, 2015 18:29
Show Gist options
  • Save sarfraznawaz2005/0a0964acf13f55118608 to your computer and use it in GitHub Desktop.
Save sarfraznawaz2005/0a0964acf13f55118608 to your computer and use it in GitHub Desktop.
Avoid double run
// simple way to avoid running code again when user click a button or trigger event in some other way
var shutdown = function() {
shutdown = function() {
alert("don't worry - we're already processing your shutdown request");
}
alert('This runs first!');
}
shutdown();
shutdown();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment