{"name":"timeout-refresh","version":"2.0.0","description":"Efficiently refresh a timer","main":"index.js","dependencies":{},"devDependencies":{"standard":"^16.0.4","tape":"^5.5.2"},"browser":"./browser.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/timeout-refresh.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/timeout-refresh/issues"},"homepage":"https://github.com/mafintosh/timeout-refresh","gitHead":"a7904be4271b84402d5e6f1bdb270bd565088095","_id":"timeout-refresh@2.0.0","_nodeVersion":"16.13.2","_npmVersion":"6.14.16","dist":{"integrity":"sha512-N/qi1NfneWGcCP1bH945YLTVuYHABSZT3lKA1NJRK2Ym/8Dsg/5mCru37Lc5SnaEZOtk9PIuciD7XwBgtN3o3A==","shasum":"0d0563ed1cd5f319bb0ac656a43d533f87dafb76","tarball":"http://registry-npm.ywwl.com/timeout-refresh/download/timeout-refresh-2.0.0.tgz","fileCount":9,"unpackedSize":7952,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiH51rACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/rw/9ERNKYVdeq3rD5zlqCMK8tUm/fZgLseQpVc1KYdTeSiJy0ZKi\r\nkXear8QKGi0fDJOa5CPEn6CDH8WPIFKAQ4ih9zLtwOs1ACKEx7wp9Yjoen4c\r\nQCXFfoG6GzKbck0DUweDjmSKA7N61a6y4yz/YG5YPGHVepRjVazVzXuae3oo\r\nXsQG+TjHughHdV7G3Dsjq1j07t2ork59OM5t5rV3h+eAkWzVAVyar8h6Mi1N\r\nX+CTWyn44gnuxEAO0aiLf7vuKE7TbmBAov9II+ghiCuXT0LZSXztKpW/Rb6L\r\nJC+zGf4tWPABTmj++4VQyPwu7UrgHY7UetWLvTp+zBjXCrMfkPf0XuG4kk0U\r\ntajGZzd8Um19/y1xlwnGnlJnBAUNDOKXwPwYUwDRo8FJ3H/Zw+sGFXjoUwJe\r\nYv5BTJZRlbdC49KZK5U/j/AVE6ivyUtIZlxqFe18pKmTZKBgI4rICostmjFr\r\nVse64l7fQr4bOSfAeFiTBElpGE9O5vVXofk9tjPExOn6aTeFU4pjd4xQ/KjG\r\nSvNYrMVzC4i83kvOEhswGKdItwjQOh8OG/wt/m8zBvop8lC7RRQ9a92nMw/e\r\n98Uw3gCGzFmxum0Vvm009xCxhLB9zbHXMI/nz/1MXbRrfqCr1EgkzvM3/s7/\r\ncc0RhjnGDUCas25873cRezeFe/9J0SIcZdc=\r\n=LvM0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC+SE4XR2Ld7lJn2ka3tmBus0D6XaZkGCo+BVp+M3cmqAiB2Xxb0SsMUjhLQ69cvqev25EIgLrE8uW/WHakleL3vRw=="}],"size":2743,"noattachment":false,"key":"/timeout-refresh/-/timeout-refresh-2.0.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-refresh_2.0.0_1646239083503_0.3064059375434598"},"_hasShrinkwrap":false,"readme":"# timeout-refresh\n\nEfficiently refresh a timer\n\n```\nnpm install timeout-refresh\n```\n\nUses `timeout.refresh` in Node.\nIn the browser a basic `clearTimeout + setTimeout` is used since no other method exists\n\n## Usage\n\n``` js\nconst Timeout = require('timeout-refresh')\n\nconst to = Timeout.once(100, function () {\n  console.log('Timed out!')\n})\n\nconst i = setInterval(function () {\n  // refresh every 50ms\n  to.refresh()\n}, 50)\n\nsetTimeout(function () {\n  // cancel the refresh after 500ms\n  clearInterval(i)\n  setTimeout(function () {\n    console.log('Should have timed out now')\n  }, 200)\n}, 500)\n```\n\n## API\n\n#### `to = Timeout.once(ms, ontimeout, [context])`\n\nMake a new refreshable timeout that fires once.\n\nIf you pass `context`, it will be set as `this` when calling `ontimeout`.\n\n#### `to = Timeout.on(ms, ontimeout, [context])`\n\nMake a new refreshable timeout that fires every `ms`.\n\nIf you pass `context`, it will be set as `this` when calling `ontimeout`.\n\n#### `to.unref()`\n\nUnref the timer.\n\n#### `to.ref()`\n\nRef the timer.\n\n#### `to.refresh()`\n\nRefresh the timeout.\n\n#### `to.destroy()`\n\nDestroy the timeout.\n\n## License\n\nMIT\n","publish_time":1646239083891,"_cnpm_publish_time":1646239083891,"dist-tags":{"latest":"2.0.1"}}