{"id":25918102,"url":"https://github.com/nickpalenchar/goodtimer","last_synced_at":"2026-01-12T02:30:00.220Z","repository":{"id":42764761,"uuid":"64604165","full_name":"nickpalenchar/goodtimer","owner":"nickpalenchar","description":"A setTimeout/setInterval for Humans (and so much more)","archived":false,"fork":false,"pushed_at":"2024-07-27T14:12:40.000Z","size":7810,"stargazers_count":50,"open_issues_count":20,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-27T00:19:45.958Z","etag":null,"topics":["countdown","milliseconds","npm","npm-package","time","timer"],"latest_commit_sha":null,"homepage":"https://nickpalenchar.github.io/goodtimer","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/nickpalenchar.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":"2016-07-31T16:36:54.000Z","updated_at":"2025-01-20T14:52:24.000Z","dependencies_parsed_at":"2024-07-30T15:58:48.875Z","dependency_job_id":null,"html_url":"https://github.com/nickpalenchar/goodtimer","commit_stats":null,"previous_names":["nickpalenchar/tminus","aeeed99/goodtimer","nickpalenchar/goodtimer"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpalenchar%2Fgoodtimer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpalenchar%2Fgoodtimer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpalenchar%2Fgoodtimer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpalenchar%2Fgoodtimer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickpalenchar","download_url":"https://codeload.github.com/nickpalenchar/goodtimer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241678154,"owners_count":20001682,"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":["countdown","milliseconds","npm","npm-package","time","timer"],"created_at":"2025-03-03T14:01:56.103Z","updated_at":"2026-01-12T02:30:00.213Z","avatar_url":"https://github.com/nickpalenchar.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cbr/\u003e\n\u003cdiv id=\"top\" align=\"center\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/goodtimer.svg?style=flat-square\u0026color=74B559\"\u003e \u003cimg src=\"https://img.shields.io/npm/dw/goodtimer?style=flat-square\u0026color=2f6e59\"\u003e \u003cimg alt=\"Snyk Vulnerabilities for GitHub Repo\" src=\"https://img.shields.io/snyk/vulnerabilities/npm/goodtimer?color=74B559\u0026style=flat-square\"\u003e\u003c/div\u003e\n\u003cimg src=\"./assets/logo.png\" alt=\"logo\"\u003e\n\u003ch3 align=\"center\"\u003e\u003cem\u003eThe Split-Second Precise JavaScript Timer\u003c/em\u003e\u003c/h3\u003e\n\n---\n\n![goodtimer demo](assets/example1.gif)\n\n## 🧐 About\n\nGoodtimer provides an accurate-to-milliseconds way of implementing `setTimeout` and `setInterval`. It's the timer of your\ndreams, providing a high-level API to easily manipulate countdowns. Here's a few things that make Goodtimer so good:\n\n* It self-corrects delays from the event loop, so it's guaranteed to stay in sync with time.\n* It comes with a flexible [`timeExpression`](#timeexpressions) syntax, so you can easily express time in a number of desirable ways.\n* Provides [drop-in replacement](docs/timeutil.md) to `setInterval`. \n* Can be used in projects like react with npm, or directly in the browser via [cdn](https://cdn.nickpal.to/goodtimer);\n\n## Installation \u0026 simple usage\n\nDownload using [npm](https://npmjs.org/package/goodtimer)\n\n```shell\nnpm i --save goodtimer\n```\n\nAnd use in your code!\n\n```javascript\nconst { Timer } = require('goodtimer');\n\nnew Timer('1:00');\n```\n\nOr replace your drifty `setInterval`s with `setGoodInterval` ⭐️:\n\n```javascript\nconst { setGoodInterval } = require('goodtimer').timeutil;\n\nsetGoodInterval(() =\u003e console.log(\"exactly 1 second!\"), 1000);\n```\n\n#### 💝 _Browser-compatible client-side version now available!_\n\n```html\n\u003cscript src=\"https://cdn.nickpal.to/goodtimer/goodtimer-3.3.0.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  new goodtimer.Timer('1:00');\n\u003c/script\u003e\n```\n\n➡️ Jump into the full docs site [here](https://goodtimer.dev) or read below for a few more quick examples :bow:\n\n---\n\n## ⏲ Simple Usage\n\n```javascript\nconst yourFn = () =\u003e {};\nnew Timer('1:00', yourFn); // replacement for setTimeout\nnew Timer('1:00', yourFn, { repeat: true }); // replacement for setInterval\n\nconst timer = new Timer('5:00'); // (Five minutes)\ntimer.pause();         // freezes timer at given time\ntimer.unpause();       // resumes timer\ntimer.reset();         // resests to initial value (in this case 5 minutes)\ntimer.toString()       // returns in UTC-like format (\"5:00.000\")\n// ~ 1 second later ~\ntimer.fmtTime(\"%M minutes %s seconds\") // -\u003e \"4 minutes 59 seconds\" (many ways to use!) \ntimer.gt('1:00');      // \"greater than\" -\u003e true\ntimer.lt('60:00:00');  // \"less than (60 hrs)\" -\u003e true\ntimer.equals('6m');    // (6 minutes, alternate notation) -\u003e false\n\n// or use the Time class and skip the controls\nconst [minute, second] = [new Time('1m'), new Time('1s')];\n\nminute.gt(second)        // -\u003e true\nsecond.equals(':01')     // -\u003e true\nminute.equals(second)    // -\u003e false\nsecond.set(minute)       // set to new value\nminute.equals(second)    // -\u003e true\nminute.toString()        // -\u003e \"1:00.000\"\n\n// `timeExpressions` are passed to Time or Timer, and can be an\n// object, number, array, or string (in multiple formats)\n// below are all the ways to write \"25 minutes and 500 milliseconds\"\n\nnew Time('25:00.5'); // string in UTC-like syntax\nnew Time('25m500ms'); // string with unit annotation\nnew Time(1500500);  // number for milliseconds\nnew Time({          // object with full names\n    minutes: 25, \n    milliseconds: 500 \n});\n```\n\nReady to jump in? See the [full Documentation site](https://goodtimer.dev) spec for many more uses and tutorials!\n\n## :clap: Supporters\n\n[![Stargazers repo roster for goodtimer](https://reporoster.com/stars/aeeed99/goodtimer)](https://github.com/aeeed99/goodtimer/stargazers)\n[![Forkers repo roster for goodtimer](https://reporoster.com/forks/aeeed99/goodtimer)](https://github.com/aeeed99/goodtimer/network/members)\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickpalenchar%2Fgoodtimer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickpalenchar%2Fgoodtimer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickpalenchar%2Fgoodtimer/lists"}