Class: EventIterator<V>
Defined in: index.ts:31
An EventIterator, used for asynchronously iterating over received values.
Type Parameters
| Type Parameter |
|---|
V extends unknown[] |
Implements
AsyncIterableIterator<V>
Constructors
Constructor
new EventIterator<
V>(emitter:EventEmitter,event:string,options:EventIteratorOptions<V>):EventIterator<V>
Defined in: index.ts:87
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The event emitter to listen to. |
event | string | The event we're listening for to receives values from. |
options | EventIteratorOptions<V> | Any extra options. |
Returns
EventIterator<V>
Properties
#ended
private#ended:boolean=false
Defined in: index.ts:50
Whether or not the EventIterator has ended.
#idle?
privatereadonlyoptional#idle:number
Defined in: index.ts:55
The amount of idle time in ms before moving on.
#idleTimer
privatereadonly#idleTimer:undefined|null|Timeout=null
Defined in: index.ts:75
The timer to track when this will idle out.
#limit
privatereadonly#limit:number
Defined in: index.ts:70
The limit before ending the EventIterator.
#passed
private#passed:number=0
Defined in: index.ts:65
The amount of events that have passed the filter.
#push()
privatereadonly#push: (this:EventIterator<V>, ...value:V) =>void
Defined in: index.ts:80
The push handler with context bound to the instance.
Parameters
| Parameter | Type |
|---|---|
this | EventIterator<V> |
...value | V |
Returns
void
#queue
private#queue:V[] =[]
Defined in: index.ts:60
The queue of received values.
emitter
readonlyemitter:EventEmitter
Defined in: index.ts:35
The emitter to listen to.
event
readonlyevent:string
Defined in: index.ts:40
The event the event iterator is listening for to receive values from.
filter
filter:
EventIteratorFilter<V>
Defined in: index.ts:45
The filter used to filter out values.
Accessors
ended
Get Signature
get ended():
boolean
Defined in: index.ts:107
Whether or not the EventIterator has ended.
Returns
boolean
Methods
[asyncIterator]()
[asyncIterator]():
AsyncIterableIterator<V>
Defined in: index.ts:184
The symbol allowing EventIterators to be used in for-await-of loops.
Returns
AsyncIterableIterator<V>
Implementation of
AsyncIterableIterator.[asyncIterator]
end()
end():
void
Defined in: index.ts:114
Ends the EventIterator.
Returns
void
next()
next():
Promise<IteratorResult<V,any>>
Defined in: index.ts:127
The next value that's received from the EventEmitter.
Returns
Promise<IteratorResult<V, any>>
Implementation of
AsyncIterableIterator.next
push()
protectedpush(...value:V):void
Defined in: index.ts:191
Pushes a value into the queue.
Parameters
| Parameter | Type |
|---|---|
...value | V |
Returns
void
return()
return():
Promise<IteratorResult<V,any>>
Defined in: index.ts:168
Handles what happens when you break or return from a loop.
Returns
Promise<IteratorResult<V, any>>
Implementation of
AsyncIterableIterator.return
throw()
throw():
Promise<IteratorResult<V,any>>
Defined in: index.ts:176
Handles what happens when you encounter an error in a loop.
Returns
Promise<IteratorResult<V, any>>
Implementation of
AsyncIterableIterator.throw