Class Collector<Model>

The collector of a data model.

Example

new Collector(client);

Type Parameters

  • Model extends Base<any>

Hierarchy

Constructors

Properties

client: Client

The client the collector belongs to.

collected: Collection<Model["id"], Model>

The collected data.

createdAt: Date

The date the collector was created.

endedAt?: Date

The date the collector was ended.

options: CollectorOptions<Model> = {}

The options of the collector.

Accessors

Methods

  • Collect a item.

    Returns

    The collected item.

    Example

    collector.collect(item);
    

    Parameters

    • item: Model

      The item to collect.

    Returns Promise<undefined | Model>

  • Dispose a collected item.

    Returns

    The disposed item.

    Example

    collector.dispose('abc');
    

    Parameters

    • itemId: Model["id"]

      The ID of the item to dispose.

    Returns undefined | Model