【文件属性】:
文件名称:retimer:您节点需要的可调度setTimeout
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-07 21:43:59
JavaScript
重定时
可重新安排您的节点需求的setTimeout。 该库用于在大量客户端/套接字上构建保持活动的功能。
将10000个函数重新调度20次,间隔为50ms(请参见bench.js ),并重复100次:
benchSetTimeout*100: 40.295s
benchRetimer*100: 36.122s
安装
npm install retimer --save
例子
var retimer = require ( 'retimer' )
var timer = retimer ( function ( ) {
throw new Error ( 'this should never get called!' )
} , 20 )
setTimeout ( function ( ) {
timer . reschedule ( 50 )
setTimeout (
【文件预览】:
retimer-master
----retimer.js(2KB)
----time.js(134B)
----time-browser.js(75B)
----bench.js(1KB)
----test.js(2KB)
----.travis.yml(63B)
----LICENSE(1KB)
----README.md(2KB)
----.gitignore(526B)
----package.json(870B)