jos*_*tme 5 javascript node.js
在Nodejs中,有没有一种方法可以清除由创建的计时器console.time而不调用console.timeEnd?
例如,请考虑以下情况:
console.time("Timer for an asynchronous operation that may fail");
this.get(somethingToGet, function(err, value){
if(!err && value != undefined){
console.timeEnd("Timer for an asynchronous operation that may fail");
} else {
// clear the timer without printing to the console
}
});
Run Code Online (Sandbox Code Playgroud)
如果没有错误,我想将计时器和标签打印到控制台,但如果有错误,我想清除它,这样它就不会永远运行,而不向控制台打印任何内容。
| 归档时间: |
|
| 查看次数: |
2843 次 |
| 最近记录: |