{"_id":"@ambassify/clock","_rev":"6-7e90384da66810ce1988a6d4aa3410ac","name":"@ambassify/clock","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ambassify/clock","version":"1.0.0","keywords":["timer","timeout","interval","clock"],"author":{"name":"Ambassify","email":"dev@ambassify.com"},"license":"MIT","_id":"@ambassify/clock@1.0.0","maintainers":[{"name":"ambassify","email":"dev@ambassify.com"}],"homepage":"https://github.com/ambassify/clock#readme","bugs":{"url":"https://github.com/ambassify/clock/issues"},"dist":{"shasum":"e5db3e60d21b23c4ab11aada2788930d99d5b437","tarball":"https://registry.npmjs.org/@ambassify/clock/-/clock-1.0.0.tgz","fileCount":7,"integrity":"sha512-CsDvQ3putXwgAgBJOlw1RPVcQsm5vDrwjdjx7st/e/lQOaCOwOhYl6WcJm/eAhoB/dcIkWdpewwQ2x5k9FBiCQ==","signatures":[{"sig":"MEUCIQCwvDZStBJoNJvXIWzS5fcPfbAkfuR573WFHVaC1ndefgIgTMymeq0j0e5zl6WVvtLeTJMj2COnWYo/I4rAOy4HR6w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7547},"main":"src/index.js","gitHead":"2fe8d364ac5bc4038800f2c8ad9565e69c5857ea","scripts":{"test":"npm -s run test:lint && npm -s run test:unit","release":"npm version patch && npm publish","test:lint":"eslint src && eslint test","test:unit":"nyc mocha"},"_npmUser":{"name":"ambassify","email":"dev@ambassify.com"},"repository":{"url":"git+https://github.com/ambassify/clock.git","type":"git"},"_npmVersion":"5.6.0","description":"A timer with drift correction","directories":{"test":"test"},"_nodeVersion":"9.4.0","dependencies":{"mitt":"^1.1.3"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^11.4.1","mocha":"^5.0.1","sinon":"^4.4.2","eslint":"^4.18.1","eslint-config-ambassify":"^1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/clock_1.0.0_1519823081632_0.24605964218929177","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-02-28T13:04:41.547Z","modified":"2025-10-09T08:36:14.941Z","1.0.0":"2018-02-28T13:04:42.546Z"},"bugs":{"url":"https://github.com/ambassify/clock/issues"},"author":{"name":"Ambassify","email":"dev@ambassify.com"},"license":"MIT","homepage":"https://github.com/ambassify/clock#readme","keywords":["timer","timeout","interval","clock"],"repository":{"url":"git+https://github.com/ambassify/clock.git","type":"git"},"description":"A timer with drift correction","maintainers":[{"email":"dev@ambassify.com","name":"ambassify-admin"},{"email":"jorgen@evens.eu","name":"jorgenevens"},{"email":"wim@sitebase.be","name":"sitebase"}],"readme":"# @ambassify/clock\n\nA timer with drift correction\n\n## Installation\n\n```sh\nnpm install --save @ambassify/clock\n```\n\n## Usage\n\n```sh\nconst Clock = require('@ambassify/clock');\n\nconst clock = new Clock(1000);\n\nclock.on('tick', function() {\n    console.log('1000ms elapsed');\n});\n\nclock.start();\n```\n\n## API\n\n### Clock\n\n**``new Clock(<interval>, [handler])``**\n\n - `interval` is the interval at which to fire the `tick` event in milliseconds.\n - `handler` optionally, a default handler for the `tick` event which will be attached for you.\n\n**``.start()``**\n\nStarts the interval, from this point onwards the `tick` event will fire every `interval` milliseconds.\n\n**``.stop()``**\n\nStops the clock from ticking, no `tick` events will be fired until the clock is restarted using `.start()`.\n\n**``.on('tick', <handler>)``**\n\nAttaches a new `tick` handler to the clock, a clock can have many `tick` handlers at the same time.\n\n**``.off(`tick`, <handler>)``**\n\nDetaches the `handler` function from the clock such that it will no longer receive `tick` events.\n\n## Contributing\n\nIf you have some issue or code you would like to add, feel free to open a Pull Request or Issue and we will look into it as soon as we can.\n\n## License\n\nWe are releasing this under a MIT License.\n\n## About us\n\nIf you would like to know more about us, be sure to have a look at [our website](https://www.ambassify.com), or our Twitter accounts [Ambassify](https://twitter.com/Ambassify), [Sitebase](https://twitter.com/Sitebase), [JorgenEvens](https://twitter.com/JorgenEvens)","readmeFilename":"README.md"}