packages/jm-event/lib/index.js
async function emitAsync (eventName, ...args) {
  // using a copy to avoid error when listener array changed
  let listeners = this.listeners(eventName)
  for (let i = 0; i < listeners.length; i++) {
    let fn = listeners[i]
    let obj = fn(...args)
    if (!!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function') obj = await obj
    if (obj !== undefined) return obj
  }
}
async function emitAsync (eventName, ...args) {
  // using a copy to avoid error when listener array changed
  let listeners = this.listeners(eventName)
  for (let i = 0; i < listeners.length; i++) {
    let fn = listeners[i]
    let obj = fn(...args)
    if (!!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function') obj = await obj
    if (obj !== undefined) return obj
  }
}
async function emitAsync ( eventName , ... args ) { // using a copy to avoid error when listener array changed let listeners = this . listeners ( eventName ) for ( let i = 0 ; i < listeners . length ; i ++ ) { let fn = listeners [ i ] let obj = fn ( ... args ) if ( ! ! obj && ( typeof obj === 'object' || typeof obj === 'function' ) && typeof obj . then === 'function' ) obj = await obj if ( obj !== undefined ) return obj } }
event module.
@module event
event module .