Members
(private, nullable) _idletimeout :Timeout
Timeout for cleanup due to inactivity
Type:
- Timeout
(private, nullable) _timeout :Timeout
Timeout for cleanup
Type:
- Timeout
(readonly) client :Client
The client that instantiated this Collector
Type:
collected :Collection
The items collected by this collector
Type:
- Collection
ended :boolean
Whether this collector has finished collecting
Type:
- boolean
filter :CollectorFilter
The filter applied to this collector
Type:
(readonly) next :Promise
Returns a promise that resolves with the next collected element;
rejects with collected elements if the collector finishes without receiving a next element
Type:
- Promise
options :CollectorOptions
The options of this collector
Type:
Methods
checkEnd()
Checks whether the collector should end, and if so, ends it.
(abstract) collect(…args) → {Object}
Handles incoming events from the `handleCollect` function. Returns null if the event should not
be collected, or returns an object describing the data that should be stored.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
Any args the event listener emits |
Returns:
Data to insert into collection, if any
- Type
- Object
(abstract) dispose(…args) → {*}
Handles incoming events from the `handleDispose`. Returns null if the event should not
be disposed, or returns the key that should be removed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
Any args the event listener emits |
Returns:
Key to remove from the collection, if any
- Type
- *
(abstract) endReason() → {string}
The reason this collector has ended or will end with.
Returns:
Reason to end the collector, if any
- Type
- string
handleCollect(…args)
Call this to handle an event as a collectable element. Accepts any event data as parameters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The arguments emitted by the listener |
Fires:
handleDispose(…args)
Call this to remove an element from the collection. Accepts any event data as parameters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The arguments emitted by the listener |
Fires:
resetTimer(optionsopt)
Resets the collectors timeout and idle timer.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Options
Properties
|
stop(reasonopt)
Stops this collector and emits the `end` event.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
reason |
string |
<optional> |
'user' | The reason this collector is ending |
Fires:
Events
collect
Emitted whenever an element is collected.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The arguments emitted by the listener |
dispose
Emitted whenever an element is disposed of.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The arguments emitted by the listener |
end
Emitted when the collector is finished collecting.
Parameters:
Name | Type | Description |
---|---|---|
collected |
Collection | The elements collected by the collector |
reason |
string | The reason the collector ended |