{"_id":"stopwatch","_rev":"7-cff9a4053545a55559441d05bed9e4e6","name":"stopwatch","description":"A managed stopwatch for Realtime Node.JS Apps","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"author":{"name":"Emerson Macedo","email":"emerleite@gmail.com","url":"http://codificando.com"},"name":"stopwatch","description":"A managed stopwatch for Realtime Node.JS Apps","version":"0.1.0","homepage":"http://github.com/emerleite/node-stopwatch","repository":{"type":"git","url":"git://github.com/emerleite/node-stopwatch.git"},"main":"index.js","scripts":{"test":"node_modules/mocha/bin/mocha -R spec"},"engines":{"node":">=0.4.0"},"dependencies":{},"devDependencies":{"mocha":"0.3.6","should":"0.3.2"},"_npmUser":{"name":"emerleite","email":"emerleite@gmail.com"},"_id":"stopwatch@0.1.0","_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"21386f6c40a4f9ec8dbdaaaa331a727248cd0b07","tarball":"https://registry.npmjs.org/stopwatch/-/stopwatch-0.1.0.tgz","integrity":"sha512-VAd10hOTulmQTdUQT0moFqgQMTFZPHFA6WmCmQj8ObsLd4lmiqDAuMaQswE03r4KeGqQK0ANmSp1EGjWdH7UlA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXFebJdbHTtPjxf6wwVkuLOPrS0A+QZ8d27wGtPFbhtAiEA9U1pL0xkrKOI3WTc7pL8HQNnUkr53nUHIQSVU4mvyIY="}]},"maintainers":[{"name":"emerleite","email":"emerleite@gmail.com"}]},"0.2.0":{"author":{"name":"Emerson Macedo","email":"emerleite@gmail.com","url":"http://codificando.com"},"name":"stopwatch","description":"A managed stopwatch for Realtime Node.JS Apps","version":"0.2.0","homepage":"http://github.com/emerleite/node-stopwatch","repository":{"type":"git","url":"git://github.com/emerleite/node-stopwatch.git"},"main":"index.js","scripts":{"test":"node_modules/mocha/bin/mocha -R spec"},"engines":{"node":">=0.8.0"},"dependencies":{},"devDependencies":{"mocha":"2.0.1","should":"4.3.0"},"gitHead":"6ea4bef76e2cb54fd10fb394391575c7622cec75","bugs":{"url":"https://github.com/emerleite/node-stopwatch/issues"},"_id":"stopwatch@0.2.0","_shasum":"7468109efb9fc9f1f6d540eef457625c54aacc49","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"emerleite","email":"emerleite@gmail.com"},"maintainers":[{"name":"emerleite","email":"emerleite@gmail.com"}],"dist":{"shasum":"7468109efb9fc9f1f6d540eef457625c54aacc49","tarball":"https://registry.npmjs.org/stopwatch/-/stopwatch-0.2.0.tgz","integrity":"sha512-fpzTHCFA1QtVI+MVHDoD8VxM0b7hnJOPUekvQPBCGyshNonsq5vVAS3rLvXNS5en2aiU3Bd+8A6JKSDRiGVWeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFinyKqjbZM0UY8fA6fDczhSZh/Mby9rU+a+eT7PAQSpAiBP0P7Ub9NVe/sQjkrOhoxvWrO1K03WURX5InOhA6aPAw=="}]}}},"readme":"[![Build Status](https://secure.travis-ci.org/emerleite/node-stopwatch.png)](http://travis-ci.org/emerleite/node-stopwatch)\n\nNode.js stopwatch\n=================\nThis project is a simple way to use a stopwatch. I've done some penny auction/bid sistems with stopwatches and also done a realtime social video visualization. These projects shares a core stopwatch logic and because it becomes hard to maintain I extracted it to this library. I hope it helps somebody else.\n\nDependencies\n------------\nOnly has dev depencencies:\n\n* mocha\n* should\n\nInstalation\n-----------\n> npm install stopwatch\n\nUsuage\n------\nTo create a stopwatch you only need a identifier and you can pass a hash with options with the stopwatch seconds. The default is 10 seconds.\n\n```js\nvar Stopwatch = require('stopwatch').Stopwatch;\n\nvar stopwatch = new Stopwatch(1, { seconds: 60 });\nstopwatch.on('tick', function(secondsLeft) {\n  //when one second pass.\n});\nstopwatch.on('end', function() {\n  //when the time ends\n});\n```\n\n### Managed\nIf you want a managed instance (per identifier) you only need to require the module and use the get function.\n\n```js\nvar StopwatchManager = require('stopwatch');\n\nvar stopwatch = StopwatchManager.get(1, {seconds: 10 });\nstopwatch.on('tick', function(secondsLeft) {\n  //when one second pass.\n});\nstopwatch.on('end', function() {\n   //when the time ends\n   //StopwatchManager also destroys the managed hash reference\n});\n\n//It will get the same instance\nvar stopwatchRecovered = StopwatchManager.get(1, {seconds: 10 });\n```\n\nIf you invoke get with the same id, it will not create another instance, but use the same stored instance. When ends, it cleans the managed reference to prevent memory leaks by strong references.\n\n### Examples\nSee the test folder. I'll write more example in a examples folder.\n\nRunning tests\n-------------\nTo run the tests you need to install mocha and should. \n    npm install\n    npm test\n\nTo-Do\n-----\n* see (<https://github.com/emerleite/node-stopwatch/issues>)\n\nAuthor\n------\n\n* Emerson Macedo (<http://codificando.com/> and <http://nodecasts.org>)\n\nLicense:\n--------\n\n(The MIT License)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"emerleite","email":"emerleite@gmail.com"}],"time":{"modified":"2022-06-27T00:30:21.689Z","created":"2011-12-13T02:40:41.937Z","0.1.0":"2011-12-13T02:40:44.126Z","0.2.0":"2014-12-05T20:45:55.381Z"},"author":{"name":"Emerson Macedo","email":"emerleite@gmail.com","url":"http://codificando.com"},"repository":{"type":"git","url":"git://github.com/emerleite/node-stopwatch.git"},"homepage":"http://github.com/emerleite/node-stopwatch","bugs":{"url":"https://github.com/emerleite/node-stopwatch/issues"},"readmeFilename":"Readme.md"}