-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.d.ts
65 lines (42 loc) · 1.45 KB
/
index.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 EventCallback = ( Event: Event, data?:any ) => void
declare const html = ( value :string ) => string
declare const _default: {
publish( subject: string, data :any )
subscribe( subject: string, callback: ((data: any ) => void) )
register(name: string, module: Module, dependencies?: any): void
start( target?:Element): void
templateConfig( options: any ): void
}
export default _default
export const html
export type Module = {
default: ((component:Component) => Promise<void> | void )
Model?: Model
View?: View
}
export type Component = {
elm: HTMLElement
dependencies: any
state : {
set( data: object ) : Promise
set( callback: ( state: object ) => any ) : Promise
get() : object
getRaw() : object
}
main( mainArgs: ( t: Component ) => Array<Function> | void ): void
publish( name: string, value: any ) : void
subscribe( name: string, value: Function ) : Function
template( data: object ) : void
unmount( callback: () => void ) : void
onupdate( 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
render( data: object ) : void
innerHTML( target: HTMLElement | string, html: string? ) : void
}
export type Model = {
[key: string] : object
}
export type View = ( state: object ) => object