3 [![NPM version][npm-image]][npm-url]
\r 
   4 [![Build status][travis-image]][travis-url]
\r 
   5 [![Test coverage][coveralls-image]][coveralls-url]
\r 
   6 [![License][license-image]][license-url]
\r 
   7 [![Downloads][downloads-image]][downloads-url]
\r 
   8 [![Gittip][gittip-image]][gittip-url]
\r 
  10 Get the first event in a set of event emitters and event pairs,
\r 
  11 then clean up after itself.
\r 
  16 $ npm install ee-first
\r 
  22 var first = require('ee-first')
\r 
  25 ### first(arr, listener)
\r 
  27 Invoke `listener` on the first event from the list specified in `arr`. `arr` is
\r 
  28 an array of arrays, with each array in the format `[ee, ...event]`. `listener`
\r 
  29 will be called only once, the first time any of the given events are emitted. If
\r 
  30 `error` is one of the listened events, then if that fires first, the `listener`
\r 
  31 will be given the `err` argument.
\r 
  33 The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the
\r 
  34 first argument emitted from an `error` event, if applicable; `ee` is the event
\r 
  35 emitter that fired; `event` is the string event name that fired; and `args` is an
\r 
  36 array of the arguments that were emitted on the event.
\r 
  39 var ee1 = new EventEmitter()
\r 
  40 var ee2 = new EventEmitter()
\r 
  43   [ee1, 'close', 'end', 'error'],
\r 
  45 ], function (err, ee, event, args) {
\r 
  52 The group of listeners can be cancelled before being invoked and have all the event
\r 
  53 listeners removed from the underlying event emitters.
\r 
  57   [ee1, 'close', 'end', 'error'],
\r 
  59 ], function (err, ee, event, args) {
\r 
  63 // cancel and clean up
\r 
  67 [npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square
\r 
  68 [npm-url]: https://npmjs.org/package/ee-first
\r 
  69 [github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square
\r 
  70 [github-url]: https://github.com/jonathanong/ee-first/tags
\r 
  71 [travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square
\r 
  72 [travis-url]: https://travis-ci.org/jonathanong/ee-first
\r 
  73 [coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square
\r 
  74 [coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master
\r 
  75 [license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square
\r 
  76 [license-url]: LICENSE.md
\r 
  77 [downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square
\r 
  78 [downloads-url]: https://npmjs.org/package/ee-first
\r 
  79 [gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
\r 
  80 [gittip-url]: https://www.gittip.com/jonathanong/
\r