{"_id":"retimer","_rev":"4577273","name":"retimer","description":"Reschedulable Timer for your node needs","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"matteo.collina","email":""}],"time":{"modified":"2026-04-10T15:46:59.000Z","created":"2015-07-08T16:41:17.770Z","4.0.0":"2023-08-11T07:59:45.003Z","3.0.0":"2021-03-02T11:06:59.109Z","2.0.0":"2018-12-13T18:27:14.919Z","1.1.0":"2017-10-09T08:16:19.320Z","1.0.1":"2015-07-11T18:44:18.748Z","1.0.0":"2015-07-11T08:32:22.318Z","0.0.1":"2015-07-08T16:41:17.770Z"},"users":{"akiva":true,"bat_coder":true},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"versions":{"4.0.0":{"name":"retimer","version":"4.0.0","description":"Reschedulable Timer for your node needs","main":"retimer.js","types":"types.d.ts","scripts":{"lint":"standard","test":"npm run test:ci && npm run test:typescript","test:ci":"tape test.js | tap-dot","test:typescript":"tsd"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","devDependencies":{"fastbench":"^1.0.1","pre-commit":"^1.2.2","standard":"^17.1.0","tap-dot":"^2.0.0","tape":"^5.6.6","tsd":"^0.28.1"},"browser":{"./time.js":"./time-browser.js","./timers.js":"./timers-browser.js"},"dependencies":{"worker-timers":"^7.0.75"},"gitHead":"2bdb42dc1547203eafbaaa1cd14f7af9f8995bbf","_id":"retimer@4.0.0","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"shasum":"41a8c09710281013ee83ef3a5f8279c02b5a4a8e","size":3948,"noattachment":false,"key":"/retimer/-/retimer-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-4.0.0.tgz"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retimer_4.0.0_1691740784824_0.3141443630158989"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-11T07:59:45.003Z","publish_time":1691740785003,"_source_registry_name":"default","_cnpm_publish_time":1691740785003},"3.0.0":{"name":"retimer","version":"3.0.0","description":"Reschedulable Timer for your node needs","main":"retimer.js","scripts":{"lint":"standard","test":"tape test.js | tap-dot"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","devDependencies":{"fastbench":"^1.0.0","pre-commit":"^1.0.10","standard":"^16.0.0","tap-dot":"^2.0.0","tape":"^5.0.0"},"browser":{"./time.js":"./time-browser.js"},"gitHead":"fd4dc9721bfca72754fbc7c5e0f2f2d630edfa72","_id":"retimer@3.0.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.11","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"98b751b1feaf1af13eb0228f8ea68b8f9da530df","size":3311,"noattachment":false,"key":"/retimer/-/retimer-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-3.0.0.tgz"},"directories":{},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retimer_3.0.0_1614683218944_0.8560379593629281"},"_hasShrinkwrap":false,"publish_time":1614683219109,"_cnpm_publish_time":1614683219109},"2.0.0":{"name":"retimer","version":"2.0.0","description":"Reschedulable Timer for your node needs","main":"retimer.js","scripts":{"lint":"standard","test":"tape test.js | faucet"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","devDependencies":{"fastbench":"^1.0.0","faucet":"0.0.1","pre-commit":"^1.0.10","standard":"^12.0.0","tape":"^4.0.0"},"browser":{"./time.js":"./time-browser.js"},"gitHead":"7b90aa31e740745e10a6a90bf09b738b56f42594","_id":"retimer@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"e8bd68c5e5a8ec2f49ccb5c636db84c04063bbca","size":3091,"noattachment":false,"key":"/retimer/-/retimer-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-2.0.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retimer_2.0.0_1544725634755_0.8922109887785181"},"_hasShrinkwrap":false,"publish_time":1544725634919,"_cnpm_publish_time":1544725634919},"1.1.0":{"name":"retimer","version":"1.1.0","description":"Reschedulable Timer for your node needs","main":"retimer.js","scripts":{"lint":"standard","test":"tape test.js | faucet"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","devDependencies":{"fastbench":"^1.0.0","faucet":"0.0.1","pre-commit":"^1.0.10","standard":"^10.0.0","tape":"^4.0.0"},"gitHead":"31ea94f195780b7b65ec573aff8dd104062e02e1","_id":"retimer@1.1.0","_npmVersion":"5.4.2","_nodeVersion":"8.6.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"8cb2cec5cc200c245622e943aa11549f25c5ed2c","size":2995,"noattachment":false,"key":"/retimer/-/retimer-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-1.1.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retimer-1.1.0.tgz_1507536978354_0.09810336516238749"},"directories":{},"publish_time":1507536979320,"_hasShrinkwrap":false,"_cnpm_publish_time":1507536979320},"1.0.1":{"name":"retimer","version":"1.0.1","description":"Reschedulable Timer for your node needs","main":"retimer.js","scripts":{"lint":"standard","test":"tape test.js | faucet"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","devDependencies":{"fastbench":"^1.0.0","faucet":"0.0.1","pre-commit":"^1.0.10","standard":"^4.5.2","tape":"^4.0.0"},"gitHead":"00b33fd90b7cbb4f928f9747b5ef6d0a9d4a84e3","_id":"retimer@1.0.1","_shasum":"e6d0040e2ce2f9cc22cfab211e78ade5120c85e9","_from":".","_npmVersion":"2.11.3","_nodeVersion":"2.3.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"e6d0040e2ce2f9cc22cfab211e78ade5120c85e9","size":3287,"noattachment":false,"key":"/retimer/-/retimer-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-1.0.1.tgz"},"directories":{},"publish_time":1436640258748,"_cnpm_publish_time":1436640258748,"_hasShrinkwrap":false},"1.0.0":{"name":"retimer","version":"1.0.0","description":"Reschedulable Timer for your node needs","main":"retimer.js","scripts":{"lint":"standard","test":"tape test.js | faucet"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","devDependencies":{"fastbench":"^1.0.0","faucet":"0.0.1","pre-commit":"^1.0.10","standard":"^4.5.2","tape":"^4.0.0"},"gitHead":"a2db92736bc0a352e4d9378a12de857159738ee4","_id":"retimer@1.0.0","_shasum":"2a7c6e59619452e44e60267e4ba2564148758694","_from":".","_npmVersion":"2.11.3","_nodeVersion":"2.3.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"2a7c6e59619452e44e60267e4ba2564148758694","size":3170,"noattachment":false,"key":"/retimer/-/retimer-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-1.0.0.tgz"},"directories":{},"publish_time":1436603542318,"_cnpm_publish_time":1436603542318,"_hasShrinkwrap":false},"0.0.1":{"name":"retimer","version":"0.0.1","description":"Reschedulable Timer for your node needs","main":"retimer.js","scripts":{"test":"tape test.js | faucet"},"repository":{"type":"git","url":"git+https://github.com/mcollina/retimer.git"},"keywords":["schedulable","reschedulable","timer","setTimeout"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"homepage":"https://github.com/mcollina/retimer#readme","gitHead":"8269f0eec6f485408953a7125ad1b7aa821d6e6f","_id":"retimer@0.0.1","_shasum":"8d0494e5b85f1ed9ccfcbbd80f8d26c8180c1b93","_from":".","_npmVersion":"2.11.3","_nodeVersion":"2.3.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"8d0494e5b85f1ed9ccfcbbd80f8d26c8180c1b93","size":1452,"noattachment":false,"key":"/retimer/-/retimer-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/retimer/download/retimer-0.0.1.tgz"},"directories":{},"publish_time":1436373677770,"_cnpm_publish_time":1436373677770,"_hasShrinkwrap":false}},"readme":"# retimer&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mcollina/retimer.png)](https://travis-ci.org/mcollina/retimer)\n\nreschedulable setTimeout for your node needs. This library is built for\nbuilding a keep alive functionality across a large numbers of\nclients/sockets.\n\nRescheduling a 10000 functions 20 times with an interval of 50ms (see\n`bench.js`), with 100 repetitions:\n\n* `benchSetTimeout*100: 40.295s`\n* `benchRetimer*100: 36.122s`\n\n\n## Install\n\n```\nnpm install retimer --save\n```\n\n## Example\n\n```js\nvar retimer = require('retimer')\nvar timer = retimer(function () {\n  throw new Error('this should never get called!')\n}, 20)\n\nsetTimeout(function () {\n  timer.reschedule(50)\n  setTimeout(function () {\n    timer.clear()\n  }, 10)\n}, 10)\n```\n\n## API\n\n### retimer(callback, timeout, [...args])\n\nExactly like your beloved `setTimeout`.\nReturns a `Retimer object`\n\n### timer.reschedule(timeout)\n\nReschedule the timer.\nRetimer will not gove any performance benefit if the specified timeout comes __before__ the original timeout.\n\n### timer.clear()\n\nClear the timer, like your beloved `clearTimeout`.\n\n## How it works\n\nTimers are stored in a Linked List in node.js, if you create a lot of\ntimers this Linked List becomes massive which makes __removing a timer an expensive operation__.\nRetimer let the old timer run at its time, and schedule a new one accordingly, when the new one is __after__ the original timeout.\nThere is no performance gain when the new timeout is before the original one as retimer will just __remove the previous timer__.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mcollina/retimer#readme","bugs":{"url":"https://github.com/mcollina/retimer/issues"},"license":"MIT"}