Last active
November 1, 2016 04:52
-
-
Save NervosaX/030a2e77f2600e47a26afbb831b70d6d to your computer and use it in GitHub Desktop.
Cerebral libdef WIP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare type CerebralPath = string | Array<string>; | |
declare module 'cerebral' { | |
declare interface StateFunc { | |
set(path: CerebralPath, value: ?any): void; | |
get(path: CerebralPath): void; | |
} | |
declare interface OutputFuncEmptyT { | |
(output: ?Object): void; | |
} | |
declare type OutputFuncAsyncT = { | |
[key: string]: OutputFuncEmptyT | |
} | |
declare type OutputFuncT = OutputFuncEmptyT & OutputFuncAsyncT; | |
declare type ControllerT = { | |
(model: Function): ControllerT; | |
addState(state: Object): void; | |
addModules(modules: Object): void; | |
addContextProvider(provider: Function): void; | |
addServices(services: Object): void; | |
} | |
declare interface ProviderT { | |
state: StateFunc; | |
input: Object; | |
output: OutputFuncT; | |
services: Object; | |
} | |
declare module.exports: { | |
Controller: ControllerT | |
} | |
} | |
declare module 'cerebral/models/immutable' { | |
declare module.exports: Function; | |
} | |
declare module 'cerebral/operators' { | |
declare class Operators { | |
copy(from: string, to: string): void; | |
set(from: CerebralPath, to: any): void; | |
} | |
declare module.exports: Operators; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment