package.json 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {
  2. "name": "ee-first",
  3. "description": "return the first event in a set of ee/event pairs",
  4. "version": "1.1.0",
  5. "author": {
  6. "name": "Jonathan Ong",
  7. "email": "me@jongleberry.com",
  8. "url": "http://jongleberry.com"
  9. },
  10. "contributors": [
  11. {
  12. "name": "Douglas Christopher Wilson",
  13. "email": "doug@somethingdoug.com"
  14. }
  15. ],
  16. "license": "MIT",
  17. "repository": {
  18. "type": "git",
  19. "url": "git://github.com/jonathanong/ee-first"
  20. },
  21. "devDependencies": {
  22. "istanbul": "0.3.2",
  23. "mocha": "1"
  24. },
  25. "files": [
  26. "index.js",
  27. "LICENSE"
  28. ],
  29. "scripts": {
  30. "test": "mocha --reporter spec --bail --check-leaks test/",
  31. "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
  32. "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
  33. },
  34. "readme": "# EE First\r\n\r\n[![NPM version][npm-image]][npm-url]\r\n[![Build status][travis-image]][travis-url]\r\n[![Test coverage][coveralls-image]][coveralls-url]\r\n[![License][license-image]][license-url]\r\n[![Downloads][downloads-image]][downloads-url]\r\n[![Gittip][gittip-image]][gittip-url]\r\n\r\nGet the first event in a set of event emitters and event pairs,\r\nthen clean up after itself.\r\n\r\n## Install\r\n\r\n```sh\r\n$ npm install ee-first\r\n```\r\n\r\n## API\r\n\r\n```js\r\nvar first = require('ee-first')\r\n```\r\n\r\n### first(arr, listener)\r\n\r\nInvoke `listener` on the first event from the list specified in `arr`. `arr` is\r\nan array of arrays, with each array in the format `[ee, ...event]`. `listener`\r\nwill be called only once, the first time any of the given events are emitted. If\r\n`error` is one of the listened events, then if that fires first, the `listener`\r\nwill be given the `err` argument.\r\n\r\nThe `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the\r\nfirst argument emitted from an `error` event, if applicable; `ee` is the event\r\nemitter that fired; `event` is the string event name that fired; and `args` is an\r\narray of the arguments that were emitted on the event.\r\n\r\n```js\r\nvar ee1 = new EventEmitter()\r\nvar ee2 = new EventEmitter()\r\n\r\nfirst([\r\n [ee1, 'close', 'end', 'error'],\r\n [ee2, 'error']\r\n], function (err, ee, event, args) {\r\n // listener invoked\r\n})\r\n```\r\n\r\n#### .cancel()\r\n\r\nThe group of listeners can be cancelled before being invoked and have all the event\r\nlisteners removed from the underlying event emitters.\r\n\r\n```js\r\nvar thunk = first([\r\n [ee1, 'close', 'end', 'error'],\r\n [ee2, 'error']\r\n], function (err, ee, event, args) {\r\n // listener invoked\r\n})\r\n\r\n// cancel and clean up\r\nthunk.cancel()\r\n```\r\n\r\n[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square\r\n[npm-url]: https://npmjs.org/package/ee-first\r\n[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square\r\n[github-url]: https://github.com/jonathanong/ee-first/tags\r\n[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square\r\n[travis-url]: https://travis-ci.org/jonathanong/ee-first\r\n[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square\r\n[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master\r\n[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square\r\n[license-url]: LICENSE.md\r\n[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square\r\n[downloads-url]: https://npmjs.org/package/ee-first\r\n[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square\r\n[gittip-url]: https://www.gittip.com/jonathanong/\r\n",
  35. "readmeFilename": "README.md",
  36. "bugs": {
  37. "url": "https://github.com/jonathanong/ee-first/issues"
  38. },
  39. "homepage": "https://github.com/jonathanong/ee-first",
  40. "_id": "ee-first@1.1.0",
  41. "_shasum": "6a0d7c6221e490feefd92ec3f441c9ce8cd097f4",
  42. "_from": "ee-first@1.1.0",
  43. "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.0.tgz"
  44. }