mirror of https://github.com/sveltejs/svelte
Merge pull request #1208 from sveltejs/gh-1207
Add TypeScript definitions for store (fixes #1207)pull/1813/head
commit
d1f35dfd85
@ -0,0 +1,19 @@
|
||||
interface Options {
|
||||
immutable: boolean;
|
||||
}
|
||||
|
||||
interface Cancellable {
|
||||
cancel: () => void;
|
||||
}
|
||||
|
||||
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 on(name: string, callback: (data: any) => void): Cancellable;
|
||||
public set(state: State);
|
||||
}
|
Loading…
Reference in new issue