{"name":"timeout-refresh","version":"1.0.0","description":"Efficiently refresh a timer","main":"index.js","dependencies":{},"devDependencies":{"standard":"^11.0.1","tape":"^4.9.1"},"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":"70237c2035052457c79d62e93cde77ebd517b0ea","_id":"timeout-refresh@1.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"integrity":"sha512-y5ajDPPtyhumr7xRnQgOMMVR5/EXMCVHPwM7RWnMUZx9UzT8FGRBtwG4/rh2AWHkDr7JR8dBHU6NDGx7tEiEAg==","shasum":"ae4d297bb8169c93671f04f9c1865cff58571e8f","tarball":"http://registry-npm.ywwl.com/timeout-refresh/download/timeout-refresh-1.0.0.tgz","fileCount":10,"unpackedSize":5900,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfXloCRA9TVsSAnZWagAABZIP/RHrUulzDlSbDcagDYl6\nPXIHe096zLER2L6g9dWVry8bP1QROpj+lzgC9aixFcggF/T1HK/C58HQfNzQ\nIqFQm4v2BA04Hon1XygBpJAEQ4azCXeIYM1Raqtf7DRd4Ii8BvNT/y4oC3dY\n1IesUh8qLs+VcFZ/FAu6BegWjgecFdSgJWu0Ypn0AjWB76M9ESh/yUm61RIF\nvtIEvtRz9ZLuk4XzLsKM8ljW8y6f8XM2kPTRO2aO0ivaFrEokuELwe3Ii1MY\nLFcesLTrO/KezfSDGvyX20FVrbJsU9AaGzZi5qCF7qOpc33GwRbL9ktxU2Jv\neB1+xAIwtB8Rkk8IonUG81YCwXymfFLYKGLs2QAzXLWu8i5Y1sVu4vmjLExI\ngBy4Yr689Vlk6MErT1rnnMwVl5vTbAYpqQtOF/na1ZjMOZAkt7zqqiGohHeT\n74jKNGjQ5u/LB1IFI5jeR2Im1o6Z/tn7DS3i/hjT0pYZjRyXch1G9oMH+fwY\nkyRH3t97UsDxJffrJY4UDlcYBUTwlY4W2exYzEm2XaTpnsBjnkFCJApKg7iG\n7LIa8cGGuIrH/BsbnUD6SuWv4wcHC+yit9hEoSTuSVrWTLEJa7y3Vse07x0Z\nuaGzVmykfKKLCItgODyoswP7FUOmD7tDt7qpbF0OKxL1fi6LF7Xqil+s0xed\niskE\r\n=DHre\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGkFiTbUuGVrIsoZnJs18B/hDds5iTNHern0jbWN6fBlAiAlgP0rgH8ihwPdeMLTT2ohRGVj++Ea0fOGZrxG8XhmsQ=="}],"size":2353,"noattachment":false,"key":"/timeout-refresh/-/timeout-refresh-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-refresh_1.0.0_1534949736141_0.6595648746358633"},"_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":1534949736261,"_cnpm_publish_time":1534949736261,"dist-tags":{"latest":"2.0.1"}}