lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
28 lines (27 loc) • 802 B
TypeScript
/**
* Context for a {@link ConcurrentCollection} being iterated.
*
* @internal
*/
export interface ConcurrentCollectionIterator {
nextIndex: number;
endIndex: number;
}
/**
* A special collection type that can be modified while being iterated. Useful
* for implementing event listener lists.
*
* Can only add at the end of the collection, but can remove from anywhere in
* the collection (while iterating). Preserves insertion order.
*/
export declare class ConcurrentCollection<V> {
private readonly iterators;
private readonly values;
indexOf(value: V): number;
forEach(callback: (value: V) => void): void;
add(value: V): number;
private shiftBackIterators;
remove(index: number): boolean;
removeByValue(value: V): boolean;
get size(): number;
}