@domx/dataelement
Version:
A DataElement base class for handling data state changes
34 lines • 1.11 kB
TypeScript
export { RootState };
interface StateMap {
[]: StateMap | undefined;
}
declare global {
interface Window {
[]: StateMap;
}
}
declare const stateProp: unique symbol;
/**
* Used to keep track of a global state tree
* for data elements.
*/
declare class RootState {
/** Initializes/resets the root state */
static init(state: StateMap): void;
/** Returns the state at the given state path */
static get(path: string): object | null;
/** Sets the state at the given state path */
static set(path: string, value: object): void;
/** Removes the state at the given state path */
static delete(path: string): void;
/**
* Creates a copy of the root state and sets the value at the state path.
* Used for intermediate changes before committing.
*/
static draft(path: string, value: object): StateMap;
/** The current root state */
static get current(): StateMap;
private static set current(value);
static snapshot(name: string): void;
}
//# sourceMappingURL=RootState.d.ts.map