{"id":25676968,"url":"https://github.com/jamro/clockwarp","last_synced_at":"2025-11-18T11:03:28.803Z","repository":{"id":65849286,"uuid":"601160687","full_name":"jamro/clockwarp","owner":"jamro","description":"JavaScript alternative to setTimeout offering time manipulation features","archived":false,"fork":false,"pushed_at":"2023-02-17T06:56:05.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-29T18:42:41.504Z","etag":null,"topics":["events","javascript","settimeout","timeline"],"latest_commit_sha":null,"homepage":"","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/jamro.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-13T13:50:55.000Z","updated_at":"2023-02-13T19:18:26.000Z","dependencies_parsed_at":"2023-04-19T20:18:00.277Z","dependency_job_id":null,"html_url":"https://github.com/jamro/clockwarp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jamro/clockwarp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamro%2Fclockwarp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamro%2Fclockwarp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamro%2Fclockwarp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamro%2Fclockwarp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamro","download_url":"https://codeload.github.com/jamro/clockwarp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamro%2Fclockwarp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285051560,"owners_count":27106642,"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-11-18T02:00:05.759Z","response_time":61,"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":["events","javascript","settimeout","timeline"],"created_at":"2025-02-24T14:50:49.589Z","updated_at":"2025-11-18T11:03:28.798Z","avatar_url":"https://github.com/jamro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/clockwarp.svg)](https://badge.fury.io/js/clockwarp)\n\n# ClockWrap\n\nClockWarp is an alternative to the built-in `setTimeout` and `setInterval` functions. \nThis library provides time manipulation capabilities that allow you to adjust the \ntiming of events in your code. ClockWarp has a time multiplier which can be used \nto make all events run faster or slower, and it also has a fastForward method that \ncan be used to move time forward. \n\n# Installation\n\nTo install the latest version on npm locally and save it in your package's `package.json` file:\n\n```\nnpm i --save clockwarp\n```\n\n# Example\n\n```js\nconst clock = new ClockWrap()\n\nclock.setTimeout(() =\u003e console.log(\"Hello World\"), 5000);\nclock.setTimeout(() =\u003e console.log(\"This is another message\"), 5500);\n\nclock.fastForward(5000)\n// console output: Hello World\n\n// wait another 500ms\nawait new Promise((done) =\u003e setTimeout(done, 500));\n// console output: This is another message\n```\n\n# API Documentation\n\n\u003ca name=\"ClockWarp\"\u003e\u003c/a\u003e\n\n## ClockWarp\nHandle events execution on the timeline allowing time manipulation\n\n**Kind**: global class  \n\n* [ClockWarp](#ClockWarp)\n    * [new ClockWarp()](#new_ClockWarp_new)\n    * [.timeScale](#ClockWarp+timeScale)\n    * [.now](#ClockWarp+now)\n    * [.fastForward(dt)](#ClockWarp+fastForward)\n    * [.setTimeout(callback, duration, [repeat])](#ClockWarp+setTimeout) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n    * [.setInterval(callback, duration)](#ClockWarp+setInterval) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n    * [.clear(event)](#ClockWarp+clear)\n\n\u003ca name=\"new_ClockWarp_new\"\u003e\u003c/a\u003e\n\n### new ClockWarp()\nConstructor\n\n\u003ca name=\"ClockWarp+timeScale\"\u003e\u003c/a\u003e\n\n### clockWarp.timeScale\nTime multiplier for the clock. For example, when setting the value to 2,\nall events are going to be executed twice faster than usual.\n\n**Kind**: instance property of [\u003ccode\u003eClockWarp\u003c/code\u003e](#ClockWarp)  \n\u003ca name=\"ClockWarp+now\"\u003e\u003c/a\u003e\n\n### clockWarp.now\nequivalent of `performance.now()`. The value reflects all time\nmanipulations by `fastForward` or `timeScale`\n\n**Kind**: instance property of [\u003ccode\u003eClockWarp\u003c/code\u003e](#ClockWarp)  \n\u003ca name=\"ClockWarp+fastForward\"\u003e\u003c/a\u003e\n\n### clockWarp.fastForward(dt)\nMove time of the clock by specified duration.\nThis operation will execute all events scheduled for that duration\n\n**Kind**: instance method of [\u003ccode\u003eClockWarp\u003c/code\u003e](#ClockWarp)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| dt | \u003ccode\u003eNumber\u003c/code\u003e | amount of miliseconds to fast forward |\n\n\u003ca name=\"ClockWarp+setTimeout\"\u003e\u003c/a\u003e\n\n### clockWarp.setTimeout(callback, duration, [repeat]) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nsets a timer which executes a function once the timer expires.\n\n**Kind**: instance method of [\u003ccode\u003eClockWarp\u003c/code\u003e](#ClockWarp)  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - scheduled event object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| callback | \u003ccode\u003efunction\u003c/code\u003e |  | A function to be executed after the timer expires. |\n| duration | \u003ccode\u003eNumber\u003c/code\u003e |  | The time, in milliseconds that the timer should wait before the specified function or code is executed. |\n| [repeat] | \u003ccode\u003eBoolean\u003c/code\u003e | \u003ccode\u003efalse\u003c/code\u003e | internal. cause function to work as setInterval |\n\n\u003ca name=\"ClockWarp+setInterval\"\u003e\u003c/a\u003e\n\n### clockWarp.setInterval(callback, duration) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nrepeatedly calls a function, with a fixed time delay between each call.\n\n**Kind**: instance method of [\u003ccode\u003eClockWarp\u003c/code\u003e](#ClockWarp)  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - scheduled event object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| callback | \u003ccode\u003efunction\u003c/code\u003e | A function to be executed every `duration` milliseconds. The first execution happens after delay milliseconds. |\n| duration | \u003ccode\u003eNumber\u003c/code\u003e | The time, in milliseconds that the timer should wait before the specified function or code is executed. |\n\n\u003ca name=\"ClockWarp+clear\"\u003e\u003c/a\u003e\n\n### clockWarp.clear(event)\ncancels an event previously established by\ncalling `setTimeout` or `setInterval`\n\n**Kind**: instance method of [\u003ccode\u003eClockWarp\u003c/code\u003e](#ClockWarp)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| event | \u003ccode\u003eObject\u003c/code\u003e | event object to be canceled |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamro%2Fclockwarp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamro%2Fclockwarp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamro%2Fclockwarp/lists"}