Skip to content

Instantly share code, notes, and snippets.

@tuan

tuan/once.js

Created Jun 14, 2016
Embed
What would you like to do?
function once(fn) {
let done = false;
return function(...args) {
if (done) {
return void 0;
}
done = true;
return fn.apply(this, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment