Abstract
Abstract class for defining a new Collector.
Extends
EventEmitterName | Constraints | Optional | Default | Description |
---|---|---|---|---|
K | No | None | ||
V | No | None | ||
F | unknown[] | Yes | [] | None |
Constructs a new instance of the
Collector
className | Type | Optional | Description |
---|---|---|---|
client | Client<true> | No | None |
options | CollectorOptions<[V, ...F]> | Yes | None |
Emitted whenever an element is collected.
Name | Type | Optional | Description |
---|---|---|---|
args | * | No | The arguments emitted by the listener |
Emitted whenever an element is disposed of.
Name | Type | Optional | Description |
---|---|---|---|
args | * | No | The arguments emitted by the listener |
Emitted when the collector is finished collecting.
Name | Type | Optional | Description |
---|---|---|---|
collected | Collection | No | The elements collected by the collector |
reason | string | No | The reason the collector ended |
The reason this collector has ended with, or null if it hasn't ended yet
Returns a promise that resolves with the next collected element; rejects with collected elements if the collector finishes without receiving a next element
Checks whether the collector should end, and if so, ends it.
Returns
Whether the collector ended or notHandles 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.Returns
Data to insert into collection, if anyName | Type | Optional | Description |
---|---|---|---|
...args | unknown[] | No | Any args the event listener emits |
Handles incoming events from the
handleDispose
. Returns null if the event should not be disposed, or returns the key that should be removed.Returns
Key to remove from the collection, if anyName | Type | Optional | Description |
---|---|---|---|
...args | unknown[] | No | Any args the event listener emits |
Call this to handle an event as a collectable element. Accepts any event data as parameters.
Name | Type | Optional | Description |
---|---|---|---|
...args | unknown[] | No | The arguments emitted by the listener |
Call this to remove an element from the collection. Accepts any event data as parameters.
Name | Type | Optional | Description |
---|---|---|---|
...args | unknown[] | No | The arguments emitted by the listener |
Name | Type | Optional | Description |
---|---|---|---|
event | EventKey | No | None |
listener | (...args: CollectorEventTypes<K, V, F>[EventKey]) => Awaitable<void> | No | None |
Name | Type | Optional | Description |
---|---|---|---|
event | EventKey | No | None |
listener | (...args: CollectorEventTypes<K, V, F>[EventKey]) => Awaitable<void> | No | None |
Resets the collector's timeout and idle timer.
Name | Type | Optional | Description |
---|---|---|---|
options | CollectorResetTimerOptions | Yes | Options for resetting |
Stops this collector and emits the
end
event.Name | Type | Optional | Description |
---|---|---|---|
reason | string | Yes | The reason this collector is ending |