@launchdarkly/js-sdk-common
Version:
LaunchDarkly SDK for JavaScript - common code
47 lines • 1.41 kB
TypeScript
/**
* Helper class for {@link CompositeDataSource} to manage iterating on data sources and removing them on the fly.
*/
export declare class DataSourceList<T> {
private _list;
private _circular;
private _pos;
/**
* @param circular whether to loop off the end of the list back to the start
* @param initialList of content
*/
constructor(circular: boolean, initialList?: T[]);
/**
* Returns the current head and then iterates.
*/
next(): T | undefined;
/**
* Replaces all elements with the provided list and resets the position of head to the start.
*
* @param input that will replace existing list
*/
replace(input: T[]): void;
/**
* Removes the provided element from the list. If the removed element was the head, head moves to next. Consider head may be undefined if list is empty after removal.
*
* @param element to remove
* @returns true if element was removed
*/
remove(element: T): boolean;
/**
* Reset the head position to the start of the list.
*/
reset(): void;
/**
* @returns the current head position in the list, 0 indexed.
*/
pos(): number;
/**
* @returns the current length of the list
*/
length(): number;
/**
* Clears the list and resets head.
*/
clear(): void;
}
//# sourceMappingURL=dataSourceList.d.ts.map