update store types

pull/1208/head
Rich Harris 6 years ago
parent bda2310bcf
commit 59d67f085b

14
store.d.ts vendored

@ -2,22 +2,18 @@ interface Options {
immutable: boolean;
}
interface ObserveOptions {
defer: boolean;
init: boolean;
}
interface Cancellable {
cancel: () => void;
}
export declare class Store<State> {
type State = Record<string, any>;
export declare class Store {
constructor(state: State, options?: Options);
public compute(key: string, dependencies: string[]): void;
public fire(name: string, data?: any): void;
public get(): State;
public get<T>(key: string): T;
public observe<T>(key: string, callback: (value: T) => any, options?: ObserveOptions): Cancellable;
public onchange(callback: (state: State) => any): Cancellable;
public on(name: string, callback: (data: any) => void): Cancellable;
public set(state: State);
}

Loading…
Cancel
Save