forked from tinajs/tina
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
74 lines (64 loc) · 1.87 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
64
65
66
67
68
69
70
71
72
73
74
declare module "@tinajs/tina" {
export function use(plugin: any): void
type FunctionBindWith<T> = Record<string, (this: T, ...args: any[]) => void>
export interface BaseDefinitions<T> {
mixins: Array<Partial<T>>
data: { [key: string]: any }
compute: (data: { [key: string]: any }) => { [key: string]: any }
methods: FunctionBindWith<T>
setData(data: { [key: string]: any }): void
/**
* 小程序的实例
*/
$source: any
}
export interface ComponentHooks {
created: () => void
attached: () => void
ready: () => void
moved: () => void
detached: () => void
}
export interface ComponentDefinitions
extends ComponentHooks,
BaseDefinitions<ComponentDefinitions> {
properties: { [key: string]: any }
observers: FunctionBindWith<ComponentDefinitions>
pageLifetimes: FunctionBindWith<ComponentDefinitions>
triggerEvent(
name: string,
detail?: object,
options?: {
bubbles: boolean
composed: boolean
capturePhase: boolean
}
): void
}
export class Component {
static define(definitions: Partial<ComponentDefinitions>): void
static mixin(definitions: Partial<ComponentDefinitions>): void
}
export interface PageHooks {
beforeLoad: () => void
onLoad: (options?: any) => void
onReady: () => void
onShow: () => void
onHide: () => void
onUnload: () => void
}
export interface PageEvents {
onPullDownRefresh: () => void
onReachBottom: () => void
onShareAppMessage: (params: object) => void
onPageScroll: ({ scrollTop: number }) => void
}
export interface PageDefinitions
extends BaseDefinitions<PageDefinitions>,
PageEvents,
PageHooks {}
export class Page {
static define(definitions: Partial<PageDefinitions>): void
static mixin(definitions: Partial<PageDefinitions>): void
}
}