forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reflux.d.ts
63 lines (50 loc) · 1.8 KB
/
reflux.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Type definitions for RefluxJS
// Project: https://github.com/reflux/refluxjs
// Definitions by: Maurice de Beijer <https://github.com/mauricedb>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module RefluxCore {
interface StoreDefinition {
listenables?: any[],
init?: Function,
getInitialState?: Function,
[propertyName: string]: any;
}
interface ListenFn {
(...params: any[]):any,
completed: Function,
failed: Function
}
interface Listenable {
listen: ListenFn
}
interface Subscription {
stop: Function,
listenable: Listenable
}
interface Store {
hasListener(listenable: Listenable): boolean,
listenToMany(listenables: Listenable[]): void,
validateListening(listenable: Listenable): string,
listenTo(listenable: Listenable, callback: Function, defaultCallback?: Function): Subscription,
stopListeningTo(listenable: Listenable): boolean,
stopListeningToAll(): void,
fetchInitialState(listenable: Listenable, defaultCallback: Function): void,
trigger(state: any):void;
}
interface ActionsDefinition {
[index: string]:any
}
interface Actions {
[index: string]: Listenable
}
function createStore(definition: StoreDefinition): Store;
function createAction(definition: ActionsDefinition): any;
function createActions(definition: ActionsDefinition): any;
function createActions(definitions: string[]): any;
function connect(store: Store, key?: string):void;
function listenTo(store: Store, handler: string):void;
function setState(state: any):void;
}
declare module "reflux" {
export = RefluxCore;
}