{"name":"timeout-refresh","version":"1.0.3","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":"5c304c155799426ce4fd8b3070301548b79b4e2c","_id":"timeout-refresh@1.0.3","_nodeVersion":"14.10.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Mz0CX4vBGM5lj8ttbIFt7o4ZMxk/9rgudJRh76EvB7xXZMur7T/cjRiH2w4Fmkq0zxf2QpM8IFvOSRn8FEu3gA==","shasum":"7024a8ce0a09a57acc2ea86002048e6c0bff7375","tarball":"http://registry-npm.ywwl.com/timeout-refresh/download/timeout-refresh-1.0.3.tgz","fileCount":10,"unpackedSize":6598,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfeujSCRA9TVsSAnZWagAA0VAP/3O4hYvuMvcbB4eXk891\n8BlkuqjMOqB/jfdYBgGHuEgtegC5Iv/5Q98QqdjzQOfCBGOxx2kE92Caz0TC\no1/mWDi27dpYN27HBsoDBw+f4nK/+1cRGXFGig3KBwpDkZhv49XuoWsNUKgB\n+TxV7jQxnpkiUW1hbnkBkIvfDZhhHgDSXVQNMSkF482b8UCzu2wzb15Y5Eyy\nTHgT09XpB02gXZ0G4YR9+xMgIz9KRHBWXtEE9aD5ft/0XGK+kqkFlrfiLpyr\nLy6wxymG4guSC81NcV4U98Gemz60Y0LzDpsBNE4QjR8ZugXG7clTthW58MYe\nTZhhH7oJQCBPDHkfGPKFoH+rZgAwr3qxA0AVOfjc1d0WGnO9dmj7IlxAA1Bo\nrxB+0xchJAZlNV3vzvQciCQne0Qjkpf5mvEvnl9zrA76Au5pXpGWRMQ2Ohnl\nOPyo0fKgaVEWIpMdYtC1FBdkU1uDLtRrY0eBztrqHivkN84RocP82auaJNbN\nvNzPpTFxX4F07iZPMIMtBvnjZu4qvP6SPM0ttsDucBLOBiG30DmXdWzp8Ku4\nwYBf9qD+NnQSDzcMepXoF0Yqbkh7Z9fvC4RnwH2n2mmDjIs2VrY5Wx+FpDfV\nXT9raC5mbKv5VqVRE3rVHZZ0TgvJArhLsJNCtjlTh+vs+yu3wIzOwSCwZwvQ\nk62O\r\n=GUm5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA2Q2yVvcxkBccEjs1DXL49AEVfi0lsx9GY3GiPWO/7RAiEAkX/FDppsQbihPn8QioZo//TVp4dMtT+VYa4c0I2keqI="}],"size":2488,"noattachment":false,"key":"/timeout-refresh/-/timeout-refresh-1.0.3.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.3_1601890514079_0.13310513110763877"},"_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":1601890514169,"_cnpm_publish_time":1601890514169,"dist-tags":{"latest":"2.0.1"}}