Emits an event on an EventEmitter where the listener may include a callback function
asyncEmit() function that accepts an EventEmitter, an Array of args, and
a callback function. If the emitter listener function has an arity
> args.length then there is an assumed callback function on the emitter, which
means that it is doing some async work. We have to wait for the callbacks for
any async listener functions.
It works like this:
var emitter =// this is an async listeneremitteron'something'// val may be any number of input argumentssetTimeoutdone1000// this is a sync listener, no callback functionemitteron'something'asyncEmitemitter 'something' 5if err throw errconsole.log'DONE!'