Skip to content

Instantly share code, notes, and snippets.

@JamieDixon
Created April 8, 2014 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieDixon/10150579 to your computer and use it in GitHub Desktop.
Save JamieDixon/10150579 to your computer and use it in GitHub Desktop.
function once(fn) {
var isUsed = false;
return function(){
if(!isUsed)
{
isUsed = true;
var arg = Array.prototype.slice.call(arguments, 0).reverse()[0];
fn(arg);
return arg;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment