Class: Collector
Abstract class for defining a new Collector.
Abstract
Extends
EventEmitter
Extended by
Constructors
new Collector()
new Collector(
filter
,options
):Collector
Parameters
• filter: CollectorFilter
<any
>
• options: CollectorOptions
= {}
Returns
Overrides
EventEmitter.constructor
Properties
_idletimeout
protected
_idletimeout:Timeout
_timeout
protected
_timeout:Timeout
collected
collected:
Collection
<string
,any
>
ended
ended:
boolean
filter()
filter: (...
args
) =>boolean
|Promise
<boolean
>
Parameters
• ...args: any
[]
Returns
boolean
| Promise
<boolean
>
options
options:
CollectorOptions
captureRejectionSymbol
readonly
static
captureRejectionSymbol: typeofcaptureRejectionSymbol
Inherited from
EventEmitter.captureRejectionSymbol
captureRejections
static
captureRejections:boolean
Sets or gets the default captureRejection value for all emitters.
Inherited from
EventEmitter.captureRejections
defaultMaxListeners
static
defaultMaxListeners:number
Inherited from
EventEmitter.defaultMaxListeners
errorMonitor
readonly
static
errorMonitor: typeoferrorMonitor
This symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular
'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error'
event is emitted, therefore the process will still crash if no
regular 'error'
listener is installed.
Inherited from
EventEmitter.errorMonitor
Accessors
next
get
next():Promise
<any
>
Returns a promise that resolves with the next collected element; rejects with collected elements if the collector finishes without receiving a next element
Returns
Promise
<any
>
Methods
[asyncIterator]()
[asyncIterator]():
any
Allows collectors to be consumed with for-await-of loops
Returns
any
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
addListener()
addListener(
eventName
,listener
):this
Alias for emitter.on(eventName, listener)
.
Parameters
• eventName: string
| symbol
• listener
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.addListener
checkEnd()
checkEnd():
void
Checks whether the collector should end, and if so, ends it.
Returns
void