文件名称:p-time:衡量承诺解决所需的时间
文件大小:5KB
文件格式:ZIP
更新时间:2024-05-20 20:17:12
JavaScript
时间 衡量承诺解决所需的时间 安装 $ npm install p-time 用法 import pTime from 'p-time' ; import execa from 'execa' ; const promise = pTime ( execa ) ( 'sleep' , [ '1' ] ) ; await promise ; console . log ( promise . time ) ; //=> 1016 原料药 pTime(asyncFunction) 返回asyncFunction的修饰版本,该asyncFunction调用时将返回Promise ,该Promise具有经过时间的time属性(以毫秒为单位)。 pTime.log(asyncFunction) 返回asyncFunction的修饰版本,当调用该版本时,记录Promise的经过时间(以毫秒为单位)
【文件预览】:
p-time-main
----.gitignore(23B)
----package.json(845B)
----.npmrc(19B)
----index.js(881B)
----test.js(1KB)
----.github()
--------workflows()
----license(1KB)
----readme.md(831B)
----index.test-d.ts(364B)
----.gitattributes(19B)
----.editorconfig(175B)
----index.d.ts(1KB)