0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00

Merge pull request #1208 from sveltejs/gh-1207

Add TypeScript definitions for store (fixes #1207)
This commit is contained in:
Rich Harris 2018-10-27 16:57:20 -04:00 committed by GitHub
commit d1f35dfd85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -13,6 +13,7 @@
"shared.js",
"store.js",
"store.umd.js",
"store.d.ts",
"svelte",
"README.md"
],

19
store.d.ts vendored Normal file
View File

@ -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);
}