import { TestEvent, Experiments, ITest } from "../typings"; /** * A test is a collection of experiments. */ export declare class Test implements ITest { protected storageKey: string; protected experiments: Experiments; /** * Hooks up the experiment. */ constructor(storageKey?: string); /** * Sets an experiment. * @param id * @param value */ set(id: string, value: T): void; /** * Returns whether an experiment with the id exists. * @param id */ has(id: string): boolean; /** * Returns an experiment with a given id. * @param id */ get(id: string): T; /** * Returns all experiments. */ getAll(): Experiments; /** * Removes an experiment with a given id. * @param id */ remove(id: string): void; /** * Removes all experiments. */ removeAll(): void; /** * Sets an array of experiments. * @param tests */ setAll(tests: Experiments): void; /** * Returns a random variation. * @param variations */ getVariation(variations: T[]): T; /** * Saves experiments to local storage. */ save(): void; /** * Loads experiments from local storage. */ load(): void; /** * Adds event listener. * @param type * @param listener * @param options */ addEventListener(type: TestEvent, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; /** * Removes event listener. * @param type * @param listener * @param options */ removeEventListener(type: TestEvent, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; /** * Dispatches an update event. */ protected didUpdate(): void; } /** * Singleton pattern for the global experiment. */ export declare let test: ITest; /** * Sets the global experiment. * @param _test */ export declare const setTest: (_test: ITest) => void; /** * Returns the global experiment. */ export declare const getTest: () => ITest;