{"name":"timeout-refresh","version":"1.0.2","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":"fa48c9fe9a47fb7d65c134afe9122b6f5c47c285","_id":"timeout-refresh@1.0.2","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-lsO23gD/EeW53AvEoTOleUFqTIapZTu5NPzD6ndUGs0+G1IuN0+hu2kT6I3AmNX2fiOrcC6umtzMEv1XQmajgQ==","shasum":"3fee27c3543f96268816fb68a8cec132be239693","tarball":"http://registry-npm.ywwl.com/timeout-refresh/download/timeout-refresh-1.0.2.tgz","fileCount":10,"unpackedSize":5966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUAq+CRA9TVsSAnZWagAAN1QP/3y7/32SwDp3GkGr7mV3\nBZKM81ne0N2M5xnHbSCvBPkcPGGu8K44tcX74zKXCosYB/8lkkwxKwC+T3kh\nfl9+MCJcCjLrQMpDZf5pTotqqn5yCzxqU62tZr+s3W2Ue43dOamEkRm7hNzz\ny1oC2H3HJdtxCJizpzaQSAvfaVx+m49AXkbUlZJ4mYlwvwKe4U4hYK6X8ik5\ngsaE/dtUdIEs7WDa2jH+41MgrvQ9icu/UgBGPNyS15Sc2DTBeBqYc7J7Bdyz\niv8dhYZaOrsW7joA509J7o156HEM5mn1l8AN+6ehzvmAspwWvB88BJ9UoXUR\n8Ct37lbDYOMAo7Yz94dxUwklJPeG52vQiHZmTROJ+g9d+1wDuUHmQ6rCWXkZ\nNDgSddSpYHNMGTj5074J9QBgRMCdAxHWS55+/EYnvGTrDs7STkNT4z2O44+7\nY/7S2Y7kuYeye/zoiV25OQlZQvPdwE5s9icp63qMIE+EWrL3luE+FvvR8MpB\nkIZUsHztrtDf4YH98NI3RUqpaG2llJk/HZU/3Qu9HFPHODC80vZ8NHCjbrMW\nWkvQvBB7RdVHAmK8J4VMWTRRbdtIIEwxMhbZy2ILKapDVfcjAJoecfzsogPY\n449MaJVIQfxjenTIbZfUUYi+MHlNYiuVuOc7LbHSZsJX+SS42oyyBcFFHP1r\n5LFK\r\n=Y06F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCa4hAFgWc5IqSJiUn1lYmvf6rXw9bZPAZdmrPyA61tJwIgFkKOC94qn3Y49Bq/Y8wN37/fSt5HarsQ2ZJjb3s2aO4="}],"size":2374,"noattachment":false,"key":"/timeout-refresh/-/timeout-refresh-1.0.2.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-refresh_1.0.2_1582303933784_0.5732240267110891"},"_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":1582303933937,"_cnpm_publish_time":1582303933937,"dist-tags":{"latest":"2.0.1"}}