1.0.0 • Published 5 years ago

suzhou_test_npm v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

EE First

NPM version Build status Test coverage License Downloads Gittip

Get the first event in a set of event emitters and event pairs, then clean up after itself.

Install

$ npm install suzhou_npm --save

API

let { suzhouInfo, suzhouInfoInEnglish } = require('suzhou_npm')
var ee1 = new suzhouInfo()
var ee2 = new suzhouInfoInEnglish()

first([
  [ee1, 'close', 'end', 'error'],
  [ee2, 'error']
], function (err, ee, event, args) {
  // listener invoked
})

.cancel()

The group of listeners can be cancelled before being invoked and have all the event listeners removed from the underlying event emitters.

var thunk = first([
  [ee1, 'close', 'end', 'error'],
  [ee2, 'error']
], function (err, ee, event, args) {
  // listener invoked
})

// cancel and clean up
thunk.cancel()