{"id":17239032,"url":"https://github.com/binarymuse/timex","last_synced_at":"2025-03-26T02:35:45.013Z","repository":{"id":27420051,"uuid":"30897388","full_name":"BinaryMuse/timex","owner":"BinaryMuse","description":"Small timer module using requestAnimationFrame and performance.now when available","archived":false,"fork":false,"pushed_at":"2016-03-10T00:43:15.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T18:58:26.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/timex","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/BinaryMuse.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":"2015-02-17T01:25:06.000Z","updated_at":"2017-12-14T13:01:37.000Z","dependencies_parsed_at":"2022-08-30T20:00:57.241Z","dependency_job_id":null,"html_url":"https://github.com/BinaryMuse/timex","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryMuse%2Ftimex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryMuse%2Ftimex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryMuse%2Ftimex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryMuse%2Ftimex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BinaryMuse","download_url":"https://codeload.github.com/BinaryMuse/timex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245577321,"owners_count":20638301,"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":[],"created_at":"2024-10-15T05:47:33.661Z","updated_at":"2025-03-26T02:35:44.982Z","avatar_url":"https://github.com/BinaryMuse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Timex\n=====\n\nTimex is a small timer module that uses `requestAnimationFrame` and `performance.now()` (or `process.hrtime` in Node) for high-accuracy timing when possible. The timer can be paused and resumed, and set to an arbitrary time.\n\nInstallation\n------------\n\nTimex is available on npm:\n\n    npm install [--save] timex\n\nYou can then require it as normal:\n\n    var Timex = require(\"timex\");\n    var timer = new Timex();\n\nTimex is also available on Bower:\n\n    bower install [--save] timex\n\n**Note:** You should *only* use the Bower version in the browser.\n\nTimex also works with browser module bundlers like Browserify and webpack.\n\nUsage\n-----\n\n**`new Timex()`**\n\nCreates a new timer.\n\n**`Timex#start([startAt])`**\n\nStarts the timer. `startAt` can optionally be passed to set the timer to a given time (in milliseconds) before starting.\n\n**`Timex#pause()`**\n\nPauses the timer.\n\n**`Timex#set(ms)`**\n\nSets the timer's current time (in milliseconds).\n\n**`Timex#getRate()`**\n\nReturns the timer's current rate. Defaults to `1  `.\n\n**`Timex#setRate(rate)`**\n\nSets the timer's rate. The rate affects how the time is calculated, not how often the timer ticks. For example, setting `rate` to `0.5` makes the timer increment time twice as slowly, but the ticks will occur just as often as before.\n\n**`Timex#register(function(time){})`**\n\nRegisters a callback that gets called each time the timer ticks. The callback receives the current time of the timer as its only argument.\n\nNote that the time will be a float when high-precision times are available (e.g. when using `performance.now`).\n\n**`Timex#unregister(function(time){})`**\n\nUnregisters a previously registered callback. Uses `===` to compare the functions.\n\n**`Timex#currentTime`**\n\nThe current time of the timer.\n\n**`Timex#running`**\n\nWhether or not the timer is currently ticking.\n\nLicense\n-------\n\nTimex is licensed under the [MIT license](LICENSE).\n\n\u003e The MIT License (MIT)\n\u003e\n\u003e Copyright (c) 2015 Michelle Tilley\n\u003e\n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy\n\u003e of this software and associated documentation files (the \"Software\"), to deal\n\u003e in the Software without restriction, including without limitation the rights\n\u003e to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\u003e copies of the Software, and to permit persons to whom the Software is\n\u003e furnished to do so, subject to the following conditions:\n\u003e\n\u003e The above copyright notice and this permission notice shall be included in\n\u003e all copies or substantial portions of the Software.\n\u003e\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\u003e IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\u003e FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\u003e AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\u003e LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\u003e OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\u003e THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarymuse%2Ftimex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarymuse%2Ftimex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarymuse%2Ftimex/lists"}