chore(emit-async/README): minor improvements/fixes

This commit is contained in:
Julien Fontanet 2020-12-03 14:15:48 +01:00
parent 43431aa9a0
commit a584daa92d
2 changed files with 12 additions and 2 deletions

View File

@ -19,6 +19,11 @@ import EE from 'events'
import emitAsync from '@xen-orchestra/emit-async'
const ee = new EE()
// exposing emitAsync on our event emitter
//
// it's not required though and we could have used directly via
// emitAsync.call(ee, event, args...)
ee.emitAsync = emitAsync
ee.on('start', async function () {
@ -26,7 +31,7 @@ ee.on('start', async function () {
})
// similar to EventEmmiter#emit() but returns a promise which resolves when all
// listeners have resolved
// listeners have settled
await ee.emitAsync('start')
// by default, it will rejects as soon as one listener reject, you can customise

View File

@ -3,6 +3,11 @@ import EE from 'events'
import emitAsync from '@xen-orchestra/emit-async'
const ee = new EE()
// exposing emitAsync on our event emitter
//
// it's not required though and we could have used directly via
// emitAsync.call(ee, event, args...)
ee.emitAsync = emitAsync
ee.on('start', async function () {
@ -10,7 +15,7 @@ ee.on('start', async function () {
})
// similar to EventEmmiter#emit() but returns a promise which resolves when all
// listeners have resolved
// listeners have settled
await ee.emitAsync('start')
// by default, it will rejects as soon as one listener reject, you can customise