telegramsjs
    Preparing search index...

    Interface ICollectorEvent<K, V>

    Interface representing the events for the collector.

    interface ICollectorEvent<K, V> {
        collect: (
            data: V,
            collect: ReadonlyCollection<K, V>,
        ) => PossiblyAsync<void>;
        dispose: (
            data: V,
            collect: ReadonlyCollection<K, V>,
        ) => PossiblyAsync<void>;
        end: (
            collected: ReadonlyCollection<K, V>,
            reason: string,
        ) => PossiblyAsync<void>;
        ignore: (data: V) => PossiblyAsync<void>;
    }

    Type Parameters

    • K
    • V

    Hierarchy (View Summary)

    Index

    Properties

    collect: (data: V, collect: ReadonlyCollection<K, V>) => PossiblyAsync<void>

    Triggered when a new item is collected. The collect function receives the item (data) and the collection itself (collect). Can perform any asynchronous or synchronous operations needed to handle the collected item.

    Type Declaration

      • (data: V, collect: ReadonlyCollection<K, V>): PossiblyAsync<void>
      • Parameters

        • data: V

          The data item to be collected.

        • collect: ReadonlyCollection<K, V>

          The collection where the data is stored.

        Returns PossiblyAsync<void>

    dispose: (data: V, collect: ReadonlyCollection<K, V>) => PossiblyAsync<void>

    Triggered when an item is removed or disposed of from the collection. The dispose function receives the data item (data) and the collection itself (collect). Use this to handle any cleanup or additional logic when an item is removed from the collection.

    Type Declaration

      • (data: V, collect: ReadonlyCollection<K, V>): PossiblyAsync<void>
      • Parameters

        • data: V

          The data item to be disposed of.

        • collect: ReadonlyCollection<K, V>

          The collection where the data is stored.

        Returns PossiblyAsync<void>

    end: (
        collected: ReadonlyCollection<K, V>,
        reason: string,
    ) => PossiblyAsync<void>

    Triggered when the collection process ends. The end function receives the final collection (collected) and a reason (reason) for the collection’s termination. Use this to handle any finalization or post-processing steps.

    Type Declaration

      • (collected: ReadonlyCollection<K, V>, reason: string): PossiblyAsync<void>
      • Parameters

        • collected: ReadonlyCollection<K, V>

          The collection of all collected data.

        • reason: string

          The reason the collection process ended.

        Returns PossiblyAsync<void>

    ignore: (data: V) => PossiblyAsync<void>

    Triggered when a data item is ignored. The ignore function is called with the ignored item (data). This is useful for cases where items do not meet certain criteria and should not be added to the collection.

    Type Declaration