The collector of a data model.

Example

new Collector(client);

Type Parameters

  • Model extends Base<any>

Hierarchy

Constructors

  • Type Parameters

    • Model extends Base<any, Model>

    Parameters

    • client: Client

      The client the collector belongs to.

    • Optional options: CollectorOptions<Model>

      The options of the collector.

    Returns Collector<Model>

Properties

client: Client
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>

Accessors

  • get createdTimestamp(): number
  • The timestamp the collector was created.

    Returns number

  • get endedTimestamp(): undefined | number
  • The timestamp the collector was ended.

    Returns undefined | number

  • get isEnded(): boolean
  • Whether the collector has ended.

    Returns boolean

  • get uptime(): number
  • The time the collector has been running.

    Returns number

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

  • Type Parameters

    Parameters

    Returns boolean

  • End the collector.

    Example

    collector.end();
    

    Returns void