-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
65 lines (60 loc) · 1.11 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
export default class PostMessageTunnel {
constructor (options: {
whiteList: string[],
/**
* 标记,该对象为服务方
* 会等待另一个tunnel来建立连接
*/
isServer?: boolean,
/**
* 发送消息的目标iframe,
* 如果是string,则会创建一个iframe,其src=target
*/
target?: string | HTMLIFrameElement;
/**
* 最大重试次数
*/
maxCheckReady?: number;
/**
* 每次重试的间隔时间
*/
checkReadyTime?: number;
/**
* 目标iframe的origin
*/
origin?: string;
});
/**
* 建立连接到iframe
*/
targetIframe?: HTMLIFrameElement;
ready (
callback: () => void
): void;
post (
eventName: string,
content: any,
callback?: (
options: {
message: any
}
) => void
): void;
post (
eventName: string,
callback?: (
options: {
message: any
}
) => void
): void;
subscribe (
callback: (
options: {
message: any,
receipt: (data: any) => void
}
) => void
): void;
destroy (): void;
}