Skip to content

Instantly share code, notes, and snippets.

@clinyong
Created February 24, 2017 00:57
Show Gist options
  • Save clinyong/6f617da71c224a74950124f942ec298e to your computer and use it in GitHub Desktop.
Save clinyong/6f617da71c224a74950124f942ec298e to your computer and use it in GitHub Desktop.
将传入的参数转成数组
var Thunk = function(fn){
return function (){
var args = Array.prototype.slice.call(arguments);
return function (callback){
args.push(callback);
return fn.apply(this, args);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment