File size: 829 Bytes
9bde4cc 1d8c3af 9bde4cc 1d8c3af 9bde4cc 1d8c3af 9bde4cc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import { StageDefinition } from "./stage";
import { PopoverDOM } from "./popover";
export type State = {
// Whether driver is initialized or not
isInitialized?: boolean;
// Used to bounce the resize event
resizeTimeout?: number;
// Used while transitioning between stages
previousHighlight?: Element;
activeHighlight?: Element;
transitionCallback?: () => void;
activeStagePosition?: StageDefinition;
stageSvg?: SVGSVGElement;
popover?: PopoverDOM;
};
let currentState: State = {};
export function setState<K extends keyof State>(key: K, value: State[K]) {
currentState[key] = value;
}
export function getState(): State;
export function getState<K extends keyof State>(key: K): State[K];
export function getState<K extends keyof State>(key?: K) {
return key ? currentState[key] : currentState;
}
|