{"id":15817044,"url":"https://github.com/numminorihsf/uniq-interval","last_synced_at":"2025-04-01T04:32:52.214Z","repository":{"id":57386297,"uuid":"57089436","full_name":"NumminorihSF/uniq-interval","owner":"NumminorihSF","description":null,"archived":false,"fork":false,"pushed_at":"2016-04-26T03:57:26.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-06T05:21:35.700Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NumminorihSF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-26T01:53:58.000Z","updated_at":"2016-04-26T02:37:13.000Z","dependencies_parsed_at":"2022-09-02T01:11:52.793Z","dependency_job_id":null,"html_url":"https://github.com/NumminorihSF/uniq-interval","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Funiq-interval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Funiq-interval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Funiq-interval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Funiq-interval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NumminorihSF","download_url":"https://codeload.github.com/NumminorihSF/uniq-interval/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246586105,"owners_count":20801026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T05:21:45.313Z","updated_at":"2025-04-01T04:32:52.192Z","avatar_url":"https://github.com/NumminorihSF.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"uniq-interval\n============\n\nModule provide `#setInterval()` and `#clearInterval()` methods that use unique setInterval \nfor many intervals if they have similar interval value.\n\n\n## Installation\n\n```sh\nnpm install uniq-interval --save\n```\n\n## Usage\n\nThe most simple usage is:\n\n```javascript\n\nvar interval = require('uniq-interval');\n\nvar tmp1 = interval.setInterval(function(){\n  console.log('interval1');\n}, 1000);\n\nvar tmp2 = interval.setInterval(function(){\n  console.log('interval2');\n}, 1000);\n\nsetTimeout(function(){\n  interval.clearInterval(tmp1);\n  setTimeout(function(){\n    interval.clearInterval(tmp2);\n  }, 10000);\n}, 10000);\n\n```\n\nExample time-line (interval is ~ 2 ms):\n\nTime                                         | 0 | 1 | 2        | 3   | 4             | 5   | ...\n---------------------------------------------|---|---|----------|-----|---------------|-----|-----\n`setInterval(callback1, 2)`                  | s |   |          |     |               |     | ...\n`setInterval(callback2, 2)`                  |   | s |          |     |               |     | ...\n`setInterval(callback3, 2)`                  |   |   | s        |     |               |     | ...\nExecute if use `interval#setInterval(cb)`    |   |   | cb1, cb2 |     | cb1, cb2, cb3 |     | ...\nExecute if use `windowTimer#setInterval(cb)` |   |   | cb1      | cb2 | cb1, cb3      | cb2 | ...\n\n\n\n\n### interval#setInterval(callback, interval [, arg1][, arg2][, ...])\n\nThis method provide same api as `windowTimer#setInterval()` in browser or `Timers#setInterval()` in node.js.\n\nIt returning id of interval to use with `interval#clearInterval()`.\n\n### interval#clearInterval(interval)\n\nThis method provide same api as `windowTimer#clearInterval()` in browser or `Timers#clearInterval()` in node.js.\n\n\n\n## LICENSE - \"MIT License\"\n\nCopyright (c) 2016 Konstantine Petryaev\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumminorihsf%2Funiq-interval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumminorihsf%2Funiq-interval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumminorihsf%2Funiq-interval/lists"}