{"name":"timeout-refresh","version":"2.0.1","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":"4db2530d8d80f094df20dc7fc4ff3ec7ddb6a8f1","_id":"timeout-refresh@2.0.1","_nodeVersion":"16.13.2","_npmVersion":"6.14.16","dist":{"integrity":"sha512-SVqEcMZBsZF9mA78rjzCrYrUs37LMJk3ShZ851ygZYW1cMeIjs9mL57KO6Iv5mmjSQnOe/29/VAfGXo+oRCiVw==","shasum":"f8ec7cf1f9d93b2635b7d4388cb820c5f6c16f98","tarball":"http://registry-npm.ywwl.com/timeout-refresh/download/timeout-refresh-2.0.1.tgz","fileCount":9,"unpackedSize":7900,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiK9daACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpG0g/8CmyfC48NasIsCccKkx9wyirBr8awojI/iahWIRTFwCNI/NKj\r\nFDtCZOonjTLa/VpetSr20DAvrE4cOjhu0J5z4LT91z+i4bnNqxFcC0y29Mlk\r\ncyWt7qQktMEYrChLTR0t5Sv8i+Mr7i4Kk7NSRfMZf9UYFBsqZP0ep6mM1NPB\r\n2sOVHw4fmpiI2bZqwh96lN/ogqtH3OJIc8PH7azIuJYCNeJ2lJ3zbboMyf/m\r\nFZ7ycXORoFGWu6I0tOVkiAsCV7lKdH0/4/SU2Y4rT2ZCA8Ftx2j/0H7FfM0c\r\n5qKFouq3paHQPRvK+rwaQRYstglbQreOReIUAGusGmKWY6+FELZJOkbfz6QF\r\nL7xJDMNpAubKzmm2U5fMazMgeH/5OI6RNt2z6b11V/VWzsmgIKiLkfUxPVdo\r\ncsuoCHDlKCyug206dTqcB9O6T3C8TxJnroOuhTva+eybe5XW+7P47qp8OVBD\r\nTF7UM8kXH5kS0TRdNHDqdwBAHajsYeCZ6NUx4HiYMlcSl7p6IyBlatUNFWKA\r\nPXGazeQ9KRl5gk1G+sZ8/vgkCQLaV2hr4lFYVCLamVJs1r9n3efUQA7Nocd8\r\nLqJ18EGrbmyGrUSHr6ZTkBOC9nUCPnQOIPwqu0REIVlWBETB8mcPf7YyFB13\r\nSm/FAYNXQf7wAypoj6dIncwlOyZt+7k70Yo=\r\n=nqyN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXzhS1ecvnqvMVBxlmVCLMcCG0KQWJPX7sDIIsAbtV/AiEAiWrk5RVvEd1+yNNyzPloyekb1rYCjj2u+/ve1tq4EUE="}],"size":2751,"noattachment":false,"key":"/timeout-refresh/-/timeout-refresh-2.0.1.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.1_1647040345985_0.1459066543670493"},"_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":1647040346582,"_cnpm_publish_time":1647040346582,"dist-tags":{"latest":"2.0.1"}}