You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
770 B

4 months ago
/**
* 计时装饰器
*/
export function timer(label) {
var debug = localStorage.getItem('__debug__');
return function (target, propertyKey, descriptor) {
var timerLabel = "[".concat(propertyKey, "] ").concat(label);
var func = descriptor.value;
if (typeof func === 'function') {
// eslint-disable-next-line
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
debug && console.time(timerLabel);
func.apply(this, args);
debug && console.timeEnd(timerLabel);
};
}
};
}
//# sourceMappingURL=timer.js.map