标签:url 开发 token aop span img ken 函数参数 sel
Function.prototype.before = function (beforefn) { var _self = this; return function () { beforefn.apply(this, arguments); return _self.apply(this, arguments); }; }; var func = function (param) { console.log(param); }; func =func.before( function (param) { param.b = ‘b‘; }); func({a:‘a‘});
Function.prototype.before = function (beforefn) { var _self = this; return function () { beforefn.apply(this, arguments); return _self.apply(this, arguments); }; }; var getToken = function () { return ‘token‘; }; var ajax = function (type, url, param) { console.log(param); }; ajax = ajax.before(function (type,url,param) { param.Token = getToken(); }); ajax(‘get‘,‘http://xx.com/getuseinfo‘,{name:‘test‘});
标签:url 开发 token aop span img ken 函数参数 sel
原文地址:http://www.cnblogs.com/meiyh/p/6514845.html