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 full)

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

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

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

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