Class: EventIterator
Iterate over events
for await (const evt of new EventIterator(this.eventEmitter).iterate({"event": true})) {
console.log(evt);
}
This class should optimize to never use more than 1 listener per event / eventEmitter
Constructors
new EventIterator(eventEmitter, events, prefix, initValue)
new EventIterator(
eventEmitter
,events
,prefix
?,initValue
?):EventIterator
Parameters
• eventEmitter: EventEmitter
• events: string
| Object
• prefix?: string
• initValue?: any
Returns
Source
runtime/src/utils/iterators.ts:21
Properties
eventEmitter
protected
eventEmitter:EventEmitter
Source
runtime/src/utils/iterators.ts:22
events
events:
Object
Index signature
[key
: string
]: (data
) => any
Source
runtime/src/utils/iterators.ts:16
initValue?
protected
initValue?:any
Source
runtime/src/utils/iterators.ts:25
listeners
listeners:
Object
Index signature
[key
: string
]: (evt
) => void
Source
runtime/src/utils/iterators.ts:15
prefix?
protected
prefix?:string
Source
runtime/src/utils/iterators.ts:24
queue
queue:
any
[] =[]
Source
runtime/src/utils/iterators.ts:17
resolve
resolve: () =>
void
Returns
void
Source
runtime/src/utils/iterators.ts:18
running
running:
boolean
Source
runtime/src/utils/iterators.ts:19
Methods
iterate()
iterate():
AsyncGenerator
<any
,void
,unknown
>
Returns
AsyncGenerator
<any
, void
, unknown
>
Source
runtime/src/utils/iterators.ts:58
push()
push(
event
,data
):Promise
<void
>
Parameters
• event: string
• data: any
Returns
Promise
<void
>
Source
runtime/src/utils/iterators.ts:41
stop()
stop():
void
Stop the iterator
Returns
void