{"id":23789959,"url":"https://github.com/blackglory/extra-game-loop","last_synced_at":"2026-03-05T20:34:16.518Z","repository":{"id":58011823,"uuid":"529480093","full_name":"BlackGlory/extra-game-loop","owner":"BlackGlory","description":"🌳","archived":false,"fork":false,"pushed_at":"2024-08-24T02:18:53.000Z","size":513,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-11T18:57:42.246Z","etag":null,"topics":["browser","library","npm-package","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-game-loop","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/BlackGlory.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2022-08-27T04:23:35.000Z","updated_at":"2024-08-24T02:18:56.000Z","dependencies_parsed_at":"2024-08-14T08:41:39.681Z","dependency_job_id":"74138cce-48c3-44f8-acba-5df7793bd155","html_url":"https://github.com/BlackGlory/extra-game-loop","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"9978a5f7c74edbd0f19639dc2c544259aeace14f"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-game-loop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-game-loop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-game-loop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-game-loop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackGlory","download_url":"https://codeload.github.com/BlackGlory/extra-game-loop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232104544,"owners_count":18473174,"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":["browser","library","npm-package","typescript"],"created_at":"2025-01-01T17:17:48.910Z","updated_at":"2026-03-05T20:34:16.465Z","avatar_url":"https://github.com/BlackGlory.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# extra-game-loop\n## Install\n```sh\nnpm install --save extra-game-loop\n# or\nyarn add extra-game-loop\n```\n\n## Usage\n```ts\nimport { GameLoop } from 'extra-game-loop'\n\nconst gameLoop = new GameLoop({\n  fixedDeltaTime: 1000 / 50\n, maximumDeltaTime: (1000 / 50) * 30\n, update(deltaTime: number): void {\n    // ...\n  }\n, fixedUpdate(deltaTime: number): void {\n    // ...\n  }\n, lateUpdate(deltaTime: number, alpha: number): void {\n    // ...\n  }\n, render(alpha: number): void {\n    // ...\n  }\n})\n\ngameLoop.start()\n```\n\n## API\n### GameLoop\n```ts\nclass GameLoop\u003cFixedDeltaTime extends number = number\u003e {\n  constructor(options: {\n    fixedDeltaTime: FixedDeltaTime /* ms */\n    maximumDeltaTime: number /* ms */\n    update?: (deltaTime: number /* ms */) =\u003e void\n    fixedUpdate?: (deltaTime: FixedDeltaTime /* ms */) =\u003e void\n    lateUpdate?: (deltaTime: number /* ms */, alpha: number) =\u003e void\n    render?: (alpha: number /* [0, 1) */) =\u003e void\n  })\n\n  start(): void\n  stop(): void\n  getFramesOfSecond(): number\n\n  /**\n   * This method allows you to manually advance to the next frame.\n   */\n  nextFrame(deltaTime: number): void\n}\n```\n\n### GameLoopLite\n```ts\nclass GameLoopLite {\n  constructor(options: {\n    update?: (deltaTime: number /* ms */) =\u003e void\n    render?: () =\u003e void\n  })\n\n  start(): void\n  stop(): void\n  getFramesOfSecond(): number\n\n  /**\n   * This method allows you to manually advance to the next frame.\n   */\n  nextFrame(deltaTime: number): void\n}\n```\n\nThe lite version of `GameLoop` for situations where the physics system is not needed.\n\nBasically, it can be seen as an OOP wrapper for `requestAnimationFrame`,\nso it can be used for non-game projects as well.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackglory%2Fextra-game-loop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackglory%2Fextra-game-loop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackglory%2Fextra-game-loop/lists"}