mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* reflux: add ListenerMixin * reflux: allow Reflux.createAction() `options` argument is optional. Readme says: "Create an action by calling Reflux.createAction with an optional options object."
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
// Type definitions for RefluxJS
|
|
// Project: https://github.com/reflux/refluxjs
|
|
// Definitions by: Maurice de Beijer <https://github.com/mauricedb>
|
|
// Definitions: https://github.com/DefinitelyTyped/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;
|
|
|
|
function ListenerMixin(): any;
|
|
}
|
|
|
|
declare module "reflux" {
|
|
export = RefluxCore;
|
|
}
|
|
|