{"name":"timeout-refresh","version":"1.0.1","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":"c4d24f2b2c6c174feb6e2ca95b9ad528473c520d","_id":"timeout-refresh@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"integrity":"sha512-bW5oSShdwFCN9K7RpB5dkq5bqNlGt8Lwbfxr8vprysk8hDiK5yy7Mgf2Qlz2ssE0gfQfoYhk4VLY9Hhsnr9Ulw==","shasum":"182b23c7cacd1420fa9c0eff2c6b31c3db7ce959","tarball":"http://registry-npm.ywwl.com/timeout-refresh/download/timeout-refresh-1.0.1.tgz","fileCount":10,"unpackedSize":5915,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdglgUCRA9TVsSAnZWagAAKJUP/0cWX/MhhJOkNpdT5lyZ\n/LOOLEnwzfP1TPbGfFdlis1VOBjOOjRYFl87bXQGTJAdw5ruR8QVFOyOMYMa\nUBdzJzQQAPZ09g3P5N2uw728fYkSiCPXUC3TE1JlKJSO7wQo5b12phusOOzw\ngc263i7dWbvr60OcjigG3xAGXJGLcmvM8bY9VZXRbPxubfCW+uez6JnoPASm\nzbaQkARsUb19SUkVADRH5TrePJUTeonugsFYzv1Y+qi0BCQyi6Z2U3mr3TGH\nJW1EW6PhR5P5mN5rNHC4yZ1EDJQQRJQ4HaVcbIkMx9EB3fsXmz2t6NvxXVBI\nHYo2RNbOdwLkdCXGHKQMsAHRpdOAajQu5Cuy7VCGc6C+8VWNB0Ye3c1+BKA6\ngGqD7whb0o0KkVCYmMd0vJVdQnqfufdPT0sug7Rfer695PaA/ATGivUIS28k\nbKSj+zYvxnh8vugmGch3RJkwySrLDHjLaHKbc3FcOogbSTIYm9NkptR4OE9+\nRfoo9VVhIqV9u1lFGRC5MYN1Z9wu53bUw/b+8As4Ouy0VSbi8W/aX2G8qUVa\niNaJE10NjvGaDQgEj0rweLVxcixguR8vPS/m9KpsNjQjIwXioynTpTk85zeF\njsNAX+n/FuJluk3shEfmYWTQQD93tAo4P9D0QMNmG3TYNgoqyzAGm08YIpdx\nv+zr\r\n=Ke3g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDCw1jc7hl396lMtJLtd+0j+ZLetQdFtB/40Ucnc/eyKwIge6WrqI0Fe+ZwTp5dpNGQLYYVz4OwgoRCgJrDH1BDj8w="}],"size":2355,"noattachment":false,"key":"/timeout-refresh/-/timeout-refresh-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-refresh_1.0.1_1568823315960_0.6749588938893771"},"_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":1568823316259,"_cnpm_publish_time":1568823316259,"dist-tags":{"latest":"2.0.1"}}