{"_id":"timer2","_rev":"326012","name":"timer2","description":"timer2 is an evented timer.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"time":{"modified":"2021-06-07T02:44:42.000Z","created":"2014-09-20T21:37:34.101Z","1.0.0":"2018-02-08T17:04:34.029Z","0.2.3":"2015-04-25T02:29:06.633Z","0.2.2":"2014-09-22T16:18:29.028Z","0.2.1":"2014-09-21T07:23:33.722Z","0.2.0":"2014-09-20T21:37:34.101Z"},"users":{"gochomugo":true,"misterhat":true},"repository":{"type":"git","url":"git://github.com/thenativeweb/timer2.git"},"versions":{"1.0.0":{"name":"timer2","version":"1.0.0","description":"timer2 is an evented timer.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"},{"name":"Jan-Hendrik Grundhöfer","email":"jan-hendrik.grundhoefer@thenativeweb.io"}],"main":"dist/Timer.js","dependencies":{},"devDependencies":{"assertthat":"1.0.0","roboter":"0.15.6","roboter-server":"0.15.6"},"repository":{"type":"git","url":"git://github.com/thenativeweb/timer2.git"},"keywords":["interval","timer"],"license":"MIT","gitHead":"2e63dad11ca05d30de82ec19e8620d9bd40cf0ce","bugs":{"url":"https://github.com/thenativeweb/timer2/issues"},"homepage":"https://github.com/thenativeweb/timer2#readme","_id":"timer2@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"grundhoeferj","email":"jan-hendrik.grundhoefer@thenativeweb.io"},"dist":{"shasum":"7a2441569c6564cb891f605788eef0377d89f5de","size":4990,"noattachment":false,"key":"/timer2/-/timer2-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timer2/download/timer2-1.0.0.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timer2_1.0.0_1518109473389_0.4652088424764078"},"_hasShrinkwrap":false,"publish_time":1518109474029,"_cnpm_publish_time":1518109474029},"0.2.3":{"name":"timer2","version":"0.2.3","description":"timer2 is an evented timer.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/Timer.js","dependencies":{"ensurethat":"0.2.2"},"devDependencies":{"assertthat":"0.6.0","grunt":"0.4.5","tourism":"0.16.1"},"repository":{"type":"git","url":"git://github.com/thenativeweb/timer2.git"},"keywords":["interval","timer"],"license":"MIT","gitHead":"f849a2259ebcf547efb83b4e604b4ba4274de75a","bugs":{"url":"https://github.com/thenativeweb/timer2/issues"},"homepage":"https://github.com/thenativeweb/timer2","_id":"timer2@0.2.3","scripts":{},"_shasum":"160366896432915b8d8ddc4078d4859b99ebbeb5","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"160366896432915b8d8ddc4078d4859b99ebbeb5","size":3732,"noattachment":false,"key":"/timer2/-/timer2-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/timer2/download/timer2-0.2.3.tgz"},"directories":{},"publish_time":1429928946633,"_cnpm_publish_time":1429928946633,"_hasShrinkwrap":false},"0.2.2":{"name":"timer2","version":"0.2.2","description":"timer2 is an evented timer.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/Timer.js","dependencies":{"node-ensurethat":"0.1.5"},"devDependencies":{"grunt":"0.4.5","node-assertthat":"0.2.0","tourism":"0.7.3"},"repository":{"type":"git","url":"git://github.com/thenativeweb/timer2.git"},"license":"MIT","gitHead":"075b8577279d91f0c4a938fac448e14f9f3143a7","bugs":{"url":"https://github.com/thenativeweb/timer2/issues"},"homepage":"https://github.com/thenativeweb/timer2","_id":"timer2@0.2.2","scripts":{},"_shasum":"b20f700be4d4f7ab4851a57cc38cfc1332e24faa","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"b20f700be4d4f7ab4851a57cc38cfc1332e24faa","size":3559,"noattachment":false,"key":"/timer2/-/timer2-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/timer2/download/timer2-0.2.2.tgz"},"directories":{},"publish_time":1411402709028,"_cnpm_publish_time":1411402709028,"_hasShrinkwrap":false},"0.2.1":{"name":"timer2","version":"0.2.1","description":"timer2 is an evented timer.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/Timer.js","dependencies":{"node-ensurethat":"0.1.5"},"devDependencies":{"grunt":"0.4.5","node-assertthat":"0.2.0","tourism":"0.7.3"},"repository":{"type":"git","url":"git://github.com/thenativeweb/timer2.git"},"license":"MIT","gitHead":"ff28f0f156b06c002093856e022af53b4117da30","bugs":{"url":"https://github.com/thenativeweb/timer2/issues"},"homepage":"https://github.com/thenativeweb/timer2","_id":"timer2@0.2.1","scripts":{},"_shasum":"14ae779060dd315c579c3bf88ec5049ac39e3683","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"14ae779060dd315c579c3bf88ec5049ac39e3683","size":3546,"noattachment":false,"key":"/timer2/-/timer2-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/timer2/download/timer2-0.2.1.tgz"},"directories":{},"publish_time":1411284213722,"_cnpm_publish_time":1411284213722,"_hasShrinkwrap":false},"0.2.0":{"name":"timer2","version":"0.2.0","description":"timer2 is an evented timer.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/Timer.js","dependencies":{"eventemitter2":"0.4.14","node-ensurethat":"0.1.5"},"devDependencies":{"grunt":"0.4.5","node-assertthat":"0.2.0","tourism":"0.7.3"},"repository":{"type":"git","url":"git://github.com/thenativeweb/timer2.git"},"license":"MIT","gitHead":"9399e0cca7136fbbd9010d91d8c05078671d4196","bugs":{"url":"https://github.com/thenativeweb/timer2/issues"},"homepage":"https://github.com/thenativeweb/timer2","_id":"timer2@0.2.0","scripts":{},"_shasum":"af47b22a9030c358e7aad948882b600468ce0a0e","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"af47b22a9030c358e7aad948882b600468ce0a0e","size":3378,"noattachment":false,"key":"/timer2/-/timer2-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timer2/download/timer2-0.2.0.tgz"},"directories":{},"publish_time":1411249054101,"_cnpm_publish_time":1411249054101,"_hasShrinkwrap":false}},"readme":"# timer2\n\ntimer2 is an evented timer.\n\n## Installation\n\n```shell\n$ npm install timer2\n```\n\n## Quick start\n\nFirst you need to add a reference to timer2 to your application.\n\n```javascript\nconst Timer = require('timer2');\n```\n\nThen you are able to create new timers by calling the `Timer` constructor with the desired timeout in milliseconds.\n\n```javascript\nconst timer = new Timer(100);\n```\n\nThe timer then periodically emits `tick` events. You can subscribe to these events using the usual `EventEmitter` functions, such as `on` and `once`.\n\n```javascript\ntimer.on('tick', () => {\n  // ...\n});\n```\n\nPlease remember that you need to unsubscribe from the `tick` event if you do not need the timer any longer. For that you can use the usual `EventEmitter` functions, such as `removeListener` and `removeAllListeners`.\n\n### Creating immediate timers\n\nBy default, timers do not start immediately, but wait for the specified number of milliseconds before emitting the first `tick` event. If you need a timer that starts immediately, provide an `options` object to the constructor and set its `immediate` property to `true`.\n\n```javascript\nconst timer = new Timer(100, {\n  immediate: true\n});\n```\n\n### Creating wobbling timers\n\nNormally, the timer ticks at a constant rate. If you want to make ticking a little unreliable, you can specify a variation for the `timeout`. This means, e.g. if you specify a timeout of 2000 ms and a variation of 500 ms, you will get ticks between every 1500 ms and 2500 ms.\n\nTo enable wobbling, provide a `variation` property within the `options` object and set its value to the desired number of milliseconds.\n\n```javascript\nconst timer = new Timer(2000, {\n  variation: 500\n});\n```\n\n### Stopping and restarting timers\n\nYou can stop a running timer at an arbitrary point in time. For that you need to call its `stop` function.\n\n```javascript\ntimer.stop();\n```\n\nTo restart a stopped timer call its `start` function accordingly.\n\n```javascript\ntimer.start();\n```\n\n### Destroying timers\n\nIf you don't longer need a timer you have to stop it and remove all subscribers.\n\n```javascript\ntimer.stop();\ntimer.removeAllListeners();\n```\n\nAlternatively, you may use the convenience function `destroy` that does all the necessary things for you.\n\n```javascript\ntimer.destroy();\n```\n\n## Running the build\n\nTo build this module use [roboter](https://www.npmjs.com/package/roboter).\n\n```shell\n$ bot\n```\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2013-2018 the native web.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/thenativeweb/timer2#readme","bugs":{"url":"https://github.com/thenativeweb/timer2/issues"},"license":"MIT"}