{"id":19419697,"url":"https://github.com/rwu823/raf-pause","last_synced_at":"2025-07-04T17:04:47.869Z","repository":{"id":41903147,"uuid":"142574667","full_name":"rwu823/raf-pause","owner":"rwu823","description":"🕐Set timeout in requestAnimationFrame ","archived":false,"fork":false,"pushed_at":"2023-12-15T20:30:36.000Z","size":128,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T17:46:57.948Z","etag":null,"topics":["pause","raf","requestanimationframe","timeout","timer"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/rwu823.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":"2018-07-27T12:30:37.000Z","updated_at":"2021-07-08T06:04:49.000Z","dependencies_parsed_at":"2025-01-29T13:00:16.358Z","dependency_job_id":null,"html_url":"https://github.com/rwu823/raf-pause","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwu823%2Fraf-pause","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwu823%2Fraf-pause/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwu823%2Fraf-pause/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwu823%2Fraf-pause/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwu823","download_url":"https://codeload.github.com/rwu823/raf-pause/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240599198,"owners_count":19826959,"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":["pause","raf","requestanimationframe","timeout","timer"],"created_at":"2024-11-10T13:18:42.025Z","updated_at":"2025-02-25T04:11:57.917Z","avatar_url":"https://github.com/rwu823.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"./logo.png\" width=\"300\" /\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/raf-pause\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/raf-pause.svg?style=flat-square\u0026\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://circleci.com/gh/rwu823/raf-pause\" alt=\"Build Status\"\u003e\n    \u003cimg src=\"https://circleci.com/gh/rwu823/raf-pause.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/rwu823/raf-pause\" alt=\"Coverage\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/rwu823/raf-pause/master.svg?style=flat-square\u0026\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/rwu823/raf-pause.svg?style=flat-square\u0026\" /\u003e\n\u003c/p\u003e\n\n\n## Installation\n\n```sh\n$ npm i raf-pause\n```\n\nor\n\n```sh\n$ yard add raf-pause\n```\n\n## API\n\n### start()\nStart the timer.\n\n### clean()\nClean the timer.\n\n## Recipes\n\n```js\nimport rafPause from 'raf-pause'\n\nconst run = rafPause(() =\u003e {\n  // do something\n}, 500)\nrun.start()\n\n\nconst runAndLoop = rafPause(() =\u003e {\n  // do something in loop\n  runAndLoop.start()\n}, 500)\n\nrunAndLoop.start()\n```\n\n### In React\n\n```js\nimport rafPause from 'raf-pause'\n\ncomponentDidMount() {\n  this.countDown.start()\n}\n\ncomponentWillUnMount() {\n  this.countDown.clean()\n}\n\ncountDown = rafPause(() =\u003e {\n  this.setState({\n    ...\n  }, this.countDown)\n}, 1000)\n\n```\n\n## Fallback\nIt'll fallback to `setTimeout` if browsers don't support `requestAnimationFrame`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwu823%2Fraf-pause","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwu823%2Fraf-pause","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwu823%2Fraf-pause/lists"}