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:
commit
d1f35dfd85
@ -13,6 +13,7 @@
|
|||||||
"shared.js",
|
"shared.js",
|
||||||
"store.js",
|
"store.js",
|
||||||
"store.umd.js",
|
"store.umd.js",
|
||||||
|
"store.d.ts",
|
||||||
"svelte",
|
"svelte",
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
|
19
store.d.ts
vendored
Normal file
19
store.d.ts
vendored
Normal 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);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user