{"id":18488387,"url":"https://github.com/mathiasvr/tiny-timer","last_synced_at":"2025-06-30T21:10:32.335Z","repository":{"id":49545178,"uuid":"69062173","full_name":"mathiasvr/tiny-timer","owner":"mathiasvr","description":":clock2: Small countdown timer and stopwatch module.","archived":false,"fork":false,"pushed_at":"2021-06-13T11:11:12.000Z","size":447,"stargazers_count":40,"open_issues_count":2,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-23T13:01:19.157Z","etag":null,"topics":["countdown","stopwatch","timer"],"latest_commit_sha":null,"homepage":"","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/mathiasvr.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}},"created_at":"2016-09-23T21:32:41.000Z","updated_at":"2024-09-16T15:31:52.000Z","dependencies_parsed_at":"2022-08-29T11:01:04.957Z","dependency_job_id":null,"html_url":"https://github.com/mathiasvr/tiny-timer","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/mathiasvr/tiny-timer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Ftiny-timer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Ftiny-timer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Ftiny-timer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Ftiny-timer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathiasvr","download_url":"https://codeload.github.com/mathiasvr/tiny-timer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Ftiny-timer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261523128,"owners_count":23171965,"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","stopwatch","timer"],"created_at":"2024-11-06T12:51:40.015Z","updated_at":"2025-06-30T21:10:32.296Z","avatar_url":"https://github.com/mathiasvr.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# tiny-timer\n\n[![npm](https://img.shields.io/npm/v/tiny-timer?style=for-the-badge)](https://npm.im/tiny-timer)\n[![Build Status](https://img.shields.io/travis/com/mathiasvr/tiny-timer?style=for-the-badge)](https://travis-ci.com/mathiasvr/tiny-timer)\n![Dependency status](https://img.shields.io/librariesio/release/npm/tiny-timer?style=for-the-badge)\n![downloads](https://img.shields.io/npm/dt/tiny-timer?style=for-the-badge)\n[![license](https://img.shields.io/:license-MIT-blue?style=for-the-badge)](https://mvr.mit-license.org)\n\nSmall countdown timer and stopwatch module.\n\n## Installation\nnpm:\n```shell\n$ npm install tiny-timer\n```\nYarn:\n```shell\n$ yarn add tiny-timer\n```\n\n## Example\n```javascript\nconst Timer = require('tiny-timer')\n\nconst timer = new Timer()\n\ntimer.on('tick', (ms) =\u003e console.log('tick', ms))\ntimer.on('done', () =\u003e console.log('done!'))\ntimer.on('statusChanged', (status) =\u003e console.log('status:', status))\n\ntimer.start(5000) // run for 5 seconds\n```\n\n## Usage\n\n### `timer = new Timer({ interval: 1000, stopwatch: false })`\nOptionally set the refresh `interval` in ms, or `stopwatch` mode instead of countdown.\n\n### `timer.start(duration [, interval])` {\nStarts timer running for a `duration` specified in ms.\nOptionally override the default refresh `interval` in ms.\n\n### `timer.stop()`\nStops timer.\n\n### `timer.pause()`\nPauses timer.\n\n### `timer.resume()`\nResumes timer.\n\n## Events\n\n### `timer.on('tick', (ms) =\u003e {})`\nEvent emitted every `interval` with the current time in ms.\n\n### `timer.on('done', () =\u003e {})`\nEvent emitted when the timer reaches the `duration` set by calling `timer.start()`.\n\n### `timer.on('statusChanged', (status) =\u003e {})`\nEvent emitted when the timer status changes.\n\n## Properties\n\n### `timer.time`\nGets the current time in ms.\n\n### `timer.duration`\nGets the total `duration` the timer is running for in ms.\n\n### `timer.status`\nGets the current status of the timer as a string: `running`, `paused` or `stopped`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathiasvr%2Ftiny-timer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathiasvr%2Ftiny-timer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathiasvr%2Ftiny-timer/lists"}