{"id":18373379,"url":"https://github.com/bhirmbani/countdown-generator","last_synced_at":"2025-07-21T18:31:18.167Z","repository":{"id":46916439,"uuid":"220498963","full_name":"bhirmbani/countdown-generator","owner":"bhirmbani","description":"an opinionated  countdown generator for any javascript project.","archived":false,"fork":false,"pushed_at":"2023-01-05T00:49:54.000Z","size":783,"stargazers_count":1,"open_issues_count":10,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-13T10:07:32.402Z","etag":null,"topics":["countdown-javascript","frontend","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bhirmbani.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-08T15:50:25.000Z","updated_at":"2020-09-21T03:27:26.000Z","dependencies_parsed_at":"2023-02-03T02:31:24.936Z","dependency_job_id":null,"html_url":"https://github.com/bhirmbani/countdown-generator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bhirmbani/countdown-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhirmbani%2Fcountdown-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhirmbani%2Fcountdown-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhirmbani%2Fcountdown-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhirmbani%2Fcountdown-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bhirmbani","download_url":"https://codeload.github.com/bhirmbani/countdown-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhirmbani%2Fcountdown-generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266352508,"owners_count":23915766,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["countdown-javascript","frontend","javascript"],"created_at":"2024-11-06T00:10:10.674Z","updated_at":"2025-07-21T18:31:18.134Z","avatar_url":"https://github.com/bhirmbani.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Countdown Generator\n\ncountdown generator is an opiniated javascript library that can be combined with any javascript lib/framework to create a timer or countdown functionality.\n\n# How to install\n`npm i @bhirmbani/countdown-generator`\n\n# Features\n\n- Vanilla javascript.\n- No framework/library related. Can be extended to any library/UI library out there.\n- Timer and countdown mode.\n- Custom function to run for every interval provided.\n- Custom interval.\n- Custom label.\n\n# Demo\nCurious? [Simple codesandbox demo](https://codesandbox.io/s/countdown-generator-pwc6c).\n\n# Examples\n**React Hooks**\n```\nimport CountdownGenerator from \"@bhirmbani/countdown-generator\";\n\nfunction Component() {\n  const [hour, setHour] = useState(0);\n  const [minute, setMinute] = useState(0);\n  const [second, setSecond] = useState(0);\n\n  const backupPlan = (hour, minute, second) =\u003e {\n    localStorage.setItem(\"hour\", hour);\n    localStorage.setItem(\"minute\", minute);\n    localStorage.setItem(\"second\", second);\n  };\n  \n  const onFinishFun = () =\u003e {\n    console.log(\"finished!\");\n  };\n\n  const countdown = new CountdownGenerator({\n    hours: 1,\n    minutes: 1,\n    seconds: 5,\n    listener: {\n      hour: setHour,\n      minute: setMinute,\n      second: setSecond\n    },\n    backupPlan,\n    onFinish: onFinishFun,\n    customLabel: {\n      hour: \"hour\",\n      minute: \"min\"\n      second: \"sec\"\n    }\n  });\n\n  useEffect(() =\u003e countdown.run(), []);\n\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003ch2\u003e\n        {hour} : {minute} : {second}\n      \u003c/h2\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n# API\n\nName | Type | Description | Default value | Example\n--- | --- | --- | --- | ---\nhours | string | specify duration in hour. | 0 | '1'\nminutes | string | specify duration in minute. | 0 | '10'\nseconds | string | specify duration in second. | 0 | '15'\nonFinish | Function | a function to be called when finished. | - | -\ndebug | Boolean | if true, print the process to the console. | false | -\nbackupPlan | Function | Give you three paramaters: hour, minute and second. You can use this for keeping track every change to those parameter values. Example: store every change to localstorage or db so after user doing any state destroy activity, it will restored later. | - | `function(h,m,s){console.log(h, m ,s)}`\nlistener | Object | Have three keys: `hour, minute, second` | - | -\nlistener.hour | Function | A function that change state that related to the view in your application. It will change hour indicator for each hour passed. | - | -\nlistener.minute | Function | A function that change state that related to the view in your application. It will change minute indicator for each minute passed. | - | -\nlistener.second | Function | A function that change state that related to the view in your application. It will change second indicator for each second passed. | - | -\ntype | string | choose one: `timer` or `countdown`. | `countdown` | -\nfun | Function | A custom function that you can provide that will be called for every interval that has been set. | - | -\nevery | number | an interval that you can set to the generator (in miliseconds). Choose one: `1000, 500` or greater than `1000`. | `1000` | -\nloop | Boolean | if true, start again after finished. | `false` | -\ncustomLabel | Object | Have three keys: `hour, minute, second` | - | -\ncustomLabel.hour | string | Label that will be provided after hour value | - | 'hr' will return `${hour} hr`\ncustomLabel.minute | string | Label that will be provided after minute value | - | 'min' will return `${minute} min`\ncustomLabel.second | string | Label that will be provided after second value | - | 'sec' will return `${second} sec`\n\n# Feel Free to contribute! ✨\nFork this repo and create pull request. Open for any issues!\n\nplease use version 1.0.1 and above","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhirmbani%2Fcountdown-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhirmbani%2Fcountdown-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhirmbani%2Fcountdown-generator/lists"}