{"name":"reinterval","version":"1.0.2","description":"reschedulable setInterval for node.js","main":"index.js","scripts":{"test":"mocha tests/"},"repository":{"type":"git","url":"https://github.com/4rzael/reInterval.git"},"keywords":["node","nodejs","setInterval","retimer","schedule"],"author":{"name":"4rzael"},"license":"MIT","bugs":{"url":"https://github.com/4rzael/reInterval/issues"},"homepage":"https://github.com/4rzael/reInterval","devDependencies":{"mocha":"^2.3.4","chai":"^3.4.1","chai-as-promised":"^5.1.0","es6-shim":"^0.33.13"},"gitHead":"c65ac71e26529dd891035b601bd22a3f0edcb467","_id":"reinterval@1.0.2","_shasum":"029056fb7637844bec872f36f2c07b0d7c112e6d","_from":"./","_npmVersion":"1.4.28","_npmUser":{"name":"4rzael","email":"maxime.agor23@gmail.com"},"maintainers":[{"name":"4rzael","email":"maxime.agor23@gmail.com"}],"dist":{"shasum":"029056fb7637844bec872f36f2c07b0d7c112e6d","tarball":"http://registry-npm.ywwl.com/reinterval/download/reinterval-1.0.2.tgz","integrity":"sha512-NR0heIShZ+bpLGhShvjNuXGAOiffGqe2D3tfOfhfLwlZxj1XLYMn0SzssIQX4UE9uoybuoQZ+1zA8l30+LtHAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0PCo34GUaFqshPo8QSHRCfGI3WrUu3fkj8SGWdEkqEAIgaw/szWPEWON8NgF6ZoQ0u5RKm/sXzhtZqJZ8VaopnjE="}],"size":2662,"noattachment":false,"key":"/reinterval/-/reinterval-1.0.2.tgz"},"readme":"# reInterval\n![TRAVIS](https://travis-ci.org/4rzael/reInterval.svg)\n\n[![NPM](https://nodei.co/npm/reinterval.png?downloads=true&downloadRank=true)](https://nodei.co/npm/reinterval/)\n\nReschedulable setInterval for node.js.\n\n###### Note: Work highly inspired by [mcollina](https://github.com/mcollina)'s [retimer](https://github.com/mcollina/retimer).\n\n## Example\n\n```js\nvar reInterval = require('reInterval');\n\nvar inter = reInterval(function () {\n  console.log('this should be called after 13s');\n}, 10 * 1000);\n\n// This will reset/reschedule the interval after 3 seconds, therefore\n// the interval callback won't be called for at least 13 seconds.\nsetTimeout(function () {\n  inter.reschedule(10 * 1000);\n}, 3 * 1000);\n```\n\n\n## API:\n\n###`reInterval(callback, interval[, param1, param2, ...])`\n\nThis is exactly like setInterval.\n\n_Arguments:_\n  - `callback`: The callback to be executed repeatedly.\n  - `interval`: The number of milliseconds (thousandths of a second) that the `reInterval()` function should wait before each call to `callback`.\n  - `param1, param2, ...`: *(OPTIONAL)* These arguments are passed to the `callback` function.\n\n####returns an `interval` object with the following methods:\n\n###`interval.reschedule([interval])`\n\nThis function resets the `interval` and restarts it now.\n\n_Arguments:_\n  - `interval`: *(OPTIONAL)* This argument can be used to change the amount of milliseconds to wait before each call to the `callback` passed to the `reInterval()` function.\n\n###`interval.clear()`\n\nThis function clears the interval. Can be used to temporarily clear the `interval`, which can be rescheduled at a later time.\n\n###`interval.destroy()`\n\nThis function clears the interval, and will also clear the `callback` and `params` passed to reInterval, so calling this essentially just makes this object ready for overwriting with a new `interval` object. \n\n#### Note:\nPlease ensure that either the `interval.clear()` or `interval.destroy()` function is called before overwriting the `interval` object, because the internal `interval` can continue to run in the background unless cleared.\n\n## license\n\n**MIT**\n","publish_time":1448619579202,"_cnpm_publish_time":1448619579202,"dist-tags":{"latest":"1.1.0"}}