@funnelenvy-npm/fe-dev-utils
Version:
Helper function to build client side A/B tests
21 lines (20 loc) • 887 B
TypeScript
type WaitForConditionsOptions = {
conditions: (string | (() => boolean))[];
callback: (elements: Record<string, any>) => void;
activity?: string | null;
errorHandler?: ((errorDetails: {
activity: string | null;
error: Error;
}) => void) | null;
timeout?: number;
pollFreq?: number;
};
/**
* Poller function that waits for a set of conditions to be true before executing a callback function.
*
* @param options - Options object to configure the function.
* @throws {TypeError} - If `conditions` is not an array, `callback` is not a function,
* or `timeout` and `pollFreq` are not numbers greater than or equal to 1000 and 10, respectively.
*/
declare const waitForConditions: ({ conditions, callback, activity, errorHandler, timeout, pollFreq, }: WaitForConditionsOptions) => void;
export default waitForConditions;