Last active
August 8, 2016 12:13
-
-
Save ChJJin/407b48aadf558ed4461b to your computer and use it in GitHub Desktop.
wrap a function that would do it again easily.
This file contains hidden or 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 wrapper(cb){ | |
var args, that; | |
function doItAgain(){ | |
cb.apply(that, args); | |
} | |
function execute(){ | |
that = this; | |
args = [].slice.call(arguments, 0); | |
args.push(doItAgain); | |
doItAgain(); | |
} | |
return execute; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment