File size: 973 Bytes
9bde4cc 836d49f 9bde4cc 1d8c3af 9bde4cc 1d8c3af 9bde4cc 1d8c3af 836d49f 9bde4cc 836d49f 9bde4cc 836d49f |
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 34 35 36 37 38 39 40 41 |
import { StageDefinition } from "./stage";
import { PopoverDOM } from "./popover";
import { DriveStep } from "./driver";
export type State = {
// Whether driver is initialized or not
isInitialized?: boolean;
// Used to bounce the resize event
resizeTimeout?: number;
// Used while transitioning between stages
previousElement?: Element;
activeElement?: Element;
transitionCallback?: () => void;
activeStep?: DriveStep;
previousStep?: DriveStep;
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;
}
export function resetState() {
currentState = {};
}
|