{"id":21358028,"url":"https://github.com/tom910/frame-scheduling","last_synced_at":"2025-10-27T12:03:11.792Z","repository":{"id":26303133,"uuid":"107879799","full_name":"Tom910/frame-scheduling","owner":"Tom910","description":"Asynchronous non-blocking running many tasks in JavaScript. Demo https://codesandbox.io/s/admiring-ride-jdoq0","archived":false,"fork":false,"pushed_at":"2023-01-03T15:15:07.000Z","size":1895,"stargazers_count":68,"open_issues_count":17,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-07T06:26:06.202Z","etag":null,"topics":["async","asynctask","requestanimationframe","scheduled-jobs","scheduled-tasks","scheduler","scheduling","tasks"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Tom910.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":"2017-10-22T15:46:07.000Z","updated_at":"2024-10-24T04:12:31.000Z","dependencies_parsed_at":"2022-08-07T12:00:19.927Z","dependency_job_id":null,"html_url":"https://github.com/Tom910/frame-scheduling","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/Tom910%2Fframe-scheduling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Fframe-scheduling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Fframe-scheduling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Fframe-scheduling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tom910","download_url":"https://codeload.github.com/Tom910/frame-scheduling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225844813,"owners_count":17533161,"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":["async","asynctask","requestanimationframe","scheduled-jobs","scheduled-tasks","scheduler","scheduling","tasks"],"created_at":"2024-11-22T05:13:57.950Z","updated_at":"2025-10-27T12:03:11.717Z","avatar_url":"https://github.com/Tom910.png","language":"TypeScript","readme":"[![Build Status](https://travis-ci.org/Tom910/frame-scheduling.svg?branch=master)](https://travis-ci.org/Tom910/frame-scheduling)\n[![Coverage Status](https://coveralls.io/repos/github/Tom910/frame-scheduling/badge.svg?branch=master)](https://coveralls.io/github/Tom910/frame-scheduling?branch=master)\n\n# Frame Scheduling\nA tiny module which allows run a non-blocking layout many tasks.\n\n* **Fast.** Contains low overhead and optimized for running lots of tasks without drop fps\n* **Small.** 930 B (minified and gzipped). No dependencies. It uses [Size Limit](https://github.com/ai/size-limit) to control size.\n* **Priority** Separate tasks into different priorities. Try to complete priority tasks as quickly as possible.\n* **Isomorphic.** work in browser and node js.\n\n\n```js\nimport frameScheduling, { P_IMPORTANT } from 'frame-scheduling';\n\nframeScheduling(() =\u003e { console.log('async task') });\n```\n[Demo](https://codesandbox.io/s/admiring-ride-jdoq0)\n\nAsynchronous running tasks in JavaScript based on requestAnimationFrame. Supports priority and interrupt execution every 16 milliseconds, to achieve 60fps.\n\n## Installation\n\n```bash\n# yarn\nyarn add frame-scheduling\n\n# npm\nnpm install --save frame-scheduling\n```\n\n\n## Priority\n```js\nimport frameScheduling, { P_IMPORTANT, P_LOW } from 'frame-scheduling';\nconst result = [];\n\nframeScheduling(() =\u003e { result.push('A') }, { priority: P_LOW })\nframeScheduling(() =\u003e { result.push('B') })\nframeScheduling(() =\u003e { result.push('C') }, { priority: P_IMPORTANT })\nframeScheduling(() =\u003e { result.push('D') }, { priority: 1000 })\n\n// after doing\nconsole.log(result) // \u003e ['D', 'C', 'B', 'A']\n```\nperform priority tasks first\n\n### framing\n```js\nimport frameScheduling from 'frame-scheduling';\n\nframeScheduling(() =\u003e lightFunction()) // light \u003c 1ms exec\nframeScheduling(() =\u003e heavyFunction()) // heavy \u003e 17ms exec\nframeScheduling(() =\u003e heavyFunction2()) // heavy \u003e 17ms exec\nframeScheduling(() =\u003e lightFunction2()) // light \u003c 1ms exec\nframeScheduling(() =\u003e lightFunction3()) // light \u003c 1ms exec\n\n/*\nRuns in frame\n| lightFunction\n| heavyFunction\n    | heavyFunction2\n        | lightFunction2\n        | lightFunction3\n*/\n```\nframe-scheduling aims to achieve 60 fps\n\n## Options\n#### priority: number = 5\nIt is possible to set the priority of the function. If the function has a low priority, then each execution skip adds +1 to the priority. Thus, low-priority tasks, when something is done.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom910%2Fframe-scheduling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftom910%2Fframe-scheduling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom910%2Fframe-scheduling/lists"}