UNPKG

887 BTypeScriptView Raw
1import { State } from './index';
2export declare const STORAGE_KEY = "@storybook/ui/store";
3declare type GetState = () => State;
4declare type SetState = (a: any, b: any) => any;
5interface Upstream {
6 getState: GetState;
7 setState: SetState;
8}
9declare type Patch = Partial<State>;
10declare type InputFnPatch = (s: State) => Patch;
11declare type InputPatch = Patch | InputFnPatch;
12export interface Options {
13 persistence: 'none' | 'session' | string;
14}
15declare type CallBack = (s: State) => void;
16export default class Store {
17 upstreamGetState: GetState;
18 upstreamSetState: SetState;
19 constructor({ setState, getState }: Upstream);
20 getInitialState(base: State): any;
21 getState(): State;
22 setState(inputPatch: InputPatch, options?: Options): Promise<State>;
23 setState(inputPatch: InputPatch, callback?: CallBack, options?: Options): Promise<State>;
24}
25export {};