chore(emit-async/README): minor improvements/fixes
This commit is contained in:
parent
43431aa9a0
commit
a584daa92d
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user