mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Added RefluxJS typings
This commit is contained in:
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// 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)
|
||||
}
|
||||
|
||||
interface ActionsDefinition {
|
||||
[index: string]:any
|
||||
}
|
||||
|
||||
interface Actions {
|
||||
[index: string]: Listenable
|
||||
}
|
||||
|
||||
function createStore(definition: StoreDefinition): Store;
|
||||
|
||||
function createActions(definition: ActionsDefinition): any;
|
||||
function createActions(definitions: string[]): any;
|
||||
}
|
||||
|
||||
declare module "reflux" {
|
||||
export = RefluxCore;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user