Created
June 14, 2016 13:17
-
-
Save tuan/f3d9e69c17452b2dfb6a6852fa939023 to your computer and use it in GitHub Desktop.
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
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