{"id":17908929,"url":"https://github.com/dntzhang/raf-interval","last_synced_at":"2025-07-25T05:38:18.004Z","repository":{"id":23168277,"uuid":"26524147","full_name":"dntzhang/raf-interval","owner":"dntzhang","description":"setRafInterval and clearRafInterval with requestAnimationFrame - 40行代码实现的高性能动画定时器","archived":false,"fork":false,"pushed_at":"2023-03-07T00:46:48.000Z","size":30,"stargazers_count":81,"open_issues_count":2,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T18:39:10.944Z","etag":null,"topics":["clearinterval","requestanimationframe","setinterval","tick","ticker"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dntzhang.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-12T07:21:03.000Z","updated_at":"2024-03-20T13:02:23.000Z","dependencies_parsed_at":"2024-10-28T19:33:34.120Z","dependency_job_id":null,"html_url":"https://github.com/dntzhang/raf-interval","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.027027027027026973","last_synced_commit":"39a2a7685417b3e028f9459497613df197bb66f8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dntzhang/raf-interval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fraf-interval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fraf-interval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fraf-interval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fraf-interval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dntzhang","download_url":"https://codeload.github.com/dntzhang/raf-interval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fraf-interval/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266962256,"owners_count":24012994,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clearinterval","requestanimationframe","setinterval","tick","ticker"],"created_at":"2024-10-28T19:19:00.509Z","updated_at":"2025-07-25T05:38:17.968Z","avatar_url":"https://github.com/dntzhang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raf-interval\r\n\r\nsetRafInterval and clearRafInterval with requestAnimationFrame.\r\n\r\n# Usage\r\n\r\nbefore raf-interval:\r\n\r\n```js\r\nvar i = 0\r\nvar interval = setInterval(function() {\r\n    console.log(i++)\r\n    if (i \u003e 6) {\r\n        clearInterval(interval)\r\n    }\r\n},1000)\r\n```\r\n\r\nafter raf-interval:\r\n\r\n```js\r\nvar i = 0\r\nvar rafInterval = setRafInterval(function() {\r\n    console.log(i++)\r\n    if (i \u003e 6) {\r\n        clearRafInterval(rafInterval)\r\n    }\r\n},1000)\r\n```\r\n\r\n# Features\r\n\r\n* Support setRafInterval and clearRafInterval like setInterval and clearInterval\r\n* Automatically stops when the user switches to a different tab\r\n* High performance animation with simple API\r\n* Automatic stop the loop when it is not needed \r\n\r\n# Install \r\n\r\n```\r\n$ npm install raf-interval\r\n```\r\n\r\nor get it by CDN:\r\n\r\n* [https://unpkg.com/raf-interval@0.3.0/raf-interval.js](https://unpkg.com/raf-interval@0.3.0/raf-interval.js)\r\n\r\n\r\n# License\r\n\r\nThis content is released under the [MIT](http://opensource.org/licenses/MIT) License.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdntzhang%2Fraf-interval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdntzhang%2Fraf-interval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdntzhang%2Fraf-interval/lists"}