文章出處
文章列表
for Function
github: https://github.com/laixiangran/commonJS/blob/master/src/forFunction.js
代碼
/**
* Created by laixiangran on 2016/1/24
* homepage:http://www.cnblogs.com/laixiangran/
* for Function
*/
(function(undefined) {
var com = window.COM = window.COM || {};
com.$F = (function() {
var slice = Array.prototype.slice;
return {
bind: function(fun, thisp) {
var args = slice.call(arguments, 2);
return function() {
return fun.apply(thisp, args.concat(slice.call(arguments)));
}
},
bindAsEventListener: function(fun, thisp) {
var args = slice.call(arguments, 2);
return function(event) {
return fun.apply(thisp, [window.COM.$E.fixEvent(event)].concat(args));
}
}
};
}());
}());
參考
文章列表
全站熱搜