摘要:
var origDoSomething = Thing.prototype.doSomething;Thing.prototype.doSomething = function() { var start = Date.now(); var result = origDoSomething.apply(this, arguments); console.log((Date.now() - start) + 'ms', x, y, result); return result;} 阅读全文
摘要:
slice = Array.prototype.slice,// Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { if ( typeof context === "string" ) { var tmp = fn[ context ]; context = fn; fn = tmp; } // Quick... 阅读全文