All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.utils.imperativeState.d.ts Maven / Gradle / Ivy

Go to download

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

There is a newer version: 11.4.0
Show newest version
/**
 * Resettable state storage.
 * @example
 * ```
 * const state = new ImperativeState(() => ({
 *   foo: undefined as string | undefined,
 *   bar: [] as number[],
 *   baz: 1 as number | undefined,
 * }));
 *
 * state.records.foo = "hi";
 * console.log(state.records.foo); // prints "hi";
 * state.reset();
 * console.log(state.records.foo); // prints "default";
 *
 * // typeof state.records:
 * // {
 * //   foo: string | undefined, // actual: undefined
 * //   bar: number[],           // actual: []
 * //   baz: number | undefined, // actual: 1
 * // }
 * ```
 */
export declare class ImperativeState {
    private init;
    records: S;
    /**
     * @param init - Function that creates the default state.
     */
    constructor(init: () => S);
    reset(): void;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy