{"_id":"async-time","_rev":"77202","name":"async-time","description":"Time async functions using async-done for execution and completion. ","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"phated","email":"blaine.bublitz@gmail.com"}],"time":{"modified":"2021-06-03T10:24:50.000Z","created":"2014-06-22T00:48:40.519Z","0.0.1":"2014-06-22T01:00:10.595Z","0.0.0":"2014-06-22T00:48:40.519Z"},"users":{},"author":{"name":"Blaine Bublitz","email":"blaine@iceddev.com","url":"http://iceddev.com/"},"repository":{"type":"git","url":"https://github.com/phated/async-time"},"versions":{"0.0.1":{"name":"async-time","version":"0.0.1","description":"Time async functions using async-done for execution and completion. ","main":"index.js","scripts":{"test":"tap ./test"},"repository":{"type":"git","url":"https://github.com/phated/async-time"},"keywords":["async","done","time","streams","promises","callbacks","continuations"],"author":{"name":"Blaine Bublitz","email":"blaine@iceddev.com","url":"http://iceddev.com/"},"license":"MIT","bugs":{"url":"https://github.com/phated/async-time/issues"},"homepage":"https://github.com/phated/async-time","dependencies":{"async-done":"^0.2.0","uuid":"^1.4.1"},"devDependencies":{"tap":"^0.4.11"},"gitHead":"7648d1d231d1c525ab1f91e23d1940a13fcd0f4d","_id":"async-time@0.0.1","_shasum":"887a0924cfd43c55b38b2ec21a299ea593ccbd94","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"phated","email":"blaine@iceddev.com"},"maintainers":[{"name":"phated","email":"blaine.bublitz@gmail.com"}],"dist":{"shasum":"887a0924cfd43c55b38b2ec21a299ea593ccbd94","size":3119,"noattachment":false,"key":"/async-time/-/async-time-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-time/download/async-time-0.0.1.tgz"},"directories":{},"publish_time":1403398810595,"_cnpm_publish_time":1403398810595,"_hasShrinkwrap":false},"0.0.0":{"name":"async-time","version":"0.0.0","description":"Time async functions using async-done for execution and completion. ","main":"index.js","scripts":{"test":"tap ./test"},"repository":{"type":"git","url":"https://github.com/phated/async-time"},"keywords":["async","done","time","streams","promises","callbacks","continuations"],"author":{"name":"Blaine Bublitz","email":"blaine@iceddev.com","url":"http://iceddev.com/"},"license":"MIT","bugs":{"url":"https://github.com/phated/async-time/issues"},"homepage":"https://github.com/phated/async-time","dependencies":{"async-done":"^0.2.0","uuid":"^1.4.1"},"devDependencies":{"tap":"^0.4.11"},"gitHead":"ee2657cad7cd2f92cf5cd9e29d58235cb4ee0a71","_id":"async-time@0.0.0","_shasum":"04c52aca854b4a8d9a3f597bcf35380bdf525fe3","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"phated","email":"blaine@iceddev.com"},"maintainers":[{"name":"phated","email":"blaine.bublitz@gmail.com"}],"dist":{"shasum":"04c52aca854b4a8d9a3f597bcf35380bdf525fe3","size":3067,"noattachment":false,"key":"/async-time/-/async-time-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-time/download/async-time-0.0.0.tgz"},"directories":{},"publish_time":1403398120519,"_cnpm_publish_time":1403398120519,"_hasShrinkwrap":false}},"readme":"async-time\n==========\n\n[![Build Status](https://travis-ci.org/phated/async-time.svg?branch=master)](https://travis-ci.org/phated/async-time)\n\nTime async functions using async-done for execution and completion.\n\n## Usage\n\n```js\nvar EE = require('events').EventEmitter;\n\nvar createTimer = require('async-time');\n\nvar bus = new EE();\nvar asyncTime = createTimer(bus);\n\n// listen for timing events\nbus.on('start', function(evt){\n  // function has started\n  console.log(evt);\n});\n\nbus.on('stop', function(evt){\n  // function has stopped\n  console.log(evt);\n});\n\nasyncTime(function(cb){\n  // do async things\n  cb(null, 2);\n}, function(err, res){\n  // `error` will be undefined on successful execution of the first function.\n  // `result` will be the result from the first function.\n})\n```\n\n## API\n\n__Once a timing function is created, it is used the same as [`async-done`](https://github.com/phated/async-done).__\n\n### `createTimer(EventEmitter)` => Function\n\nThe main export is a function that allows you to create a timing function.\n\nYou must pass it an `EventEmitter` instance (or an object with `emit` and `on` methods) or it will throw.\n\nThe `EventEmitter` instance is the bus timing events are published on.\n\n### `asyncTime(fn, callback)`\n\nSee [`async-done`](https://github.com/phated/async-done) docs.\n\n### Events\n\n#### `start`\n\nThe event fired when a function begins.\n\n__Properties:__\n* `id`: uuid generated for each function. Useful for tying start and end events together.\n* `name`: name property of the function given to `asyncTime`.\n* `timestamp`: timestamp of when the function started.\n\n#### `stop`\n\nThe event fired when a function finishes.\n\n__Properties:__\n* `id`: uuid generated for each function. Useful for tying start and end events together.\n* `name`: name property of the function given to `asyncTime`.\n* `timestamp`: timestamp of when the function started.\n* `duration`: high resolution time between start and stop events. Generated by `process.hrtime(startTime)`\n","_attachments":{},"homepage":"https://github.com/phated/async-time","bugs":{"url":"https://github.com/phated/async-time/issues"},"license":"MIT"}