@ali-i18n-fe/dada-component
Version:
16 lines (14 loc) • 393 B
JavaScript
function spendTime(name, promiseMethod) {
return async function() {
let startTime = new Date();
console.log(`DADA-COMP ${name}开始运行`.magenta);
const result = await promiseMethod.apply(this, arguments);
console.log(
`DADA-COMP ${name}运行成功!耗时:${new Date() - startTime}ms`.magenta
);
return result;
};
}
module.exports = {
spendTime
};