-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtypes.d.ts
47 lines (31 loc) · 1.35 KB
/
types.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
type EventCallback = ( Event: Event, data?:any ) => void
export declare const templateConfig: (options: any) => void;
export declare const register: (name: string, module: Module, dependencies?: any) => void
export declare const start: (target?: HTMLElement) => void;
export declare const subscribe:( subject: string, callback: (data:any) => void ) => Function
export declare const publish: ( subject: string, data :any ) => void
export type Component = {
elm: HTMLElement
dependencies: any
state : {
protected( props: Array<string> ): Array<string>
set( data: object ) : Promise<any>
set( callback: ( state: object ) => any ) : Promise<any>
get() : object
getRaw() : object
}
main( mainArgs: ( t: Component ) => void ): void
publish( name: string, value: any ) : void
subscribe( name: string, value: Function ) : Function
unmount( callback: () => void ) : void
on( eventName: string, selector: string | EventCallback, callback?: EventCallback ): void
emit( eventName: string, data: any ) : void
off( eventName: string, callback: () => void ): void
trigger( eventName: string, selector :string, data: any ): void
innerHTML( target: HTMLElement | string, html?: string ) : void
}
export type Model = {
[key: string] : object
}
export type View = ( state: object ) => object
export type Template = ({ elm: HTMLElement, children: string }) => string