UNPKG

1.09 kBTypeScriptView Raw
1export as namespace BellhopIframe;
2
3interface PriorityFunction extends Function {
4 _priority: number;
5}
6
7export class BellhopEventDispatcher {
8 constructor();
9 destroy(): void;
10 listenerSorter(a: PriorityFunction, b: PriorityFunction): number;
11 off(name: string, callback?: Function): void;
12 on(name: string, callback: Function, priority?: number): void;
13 trigger(event: object | string, data?:object): void;
14
15}
16
17export class Bellhop extends BellhopEventDispatcher {
18 constructor(id?: number | string);
19 _sendLater: any[];
20 connected: boolean;
21 connecting: boolean;
22 id: string;
23 iframe: HTMLIFrameElement | null;
24 isChild: boolean;
25 origin: string;
26 connect(iframe?: HTMLIFrameElement, origin?: string ): Bellhop;
27 destroy(): void;
28 disconnect(): void;
29 fetch(event: string, callback: Function, data?: object, runOnce?: boolean): void;
30 onConnectionReceived(message: object);
31 receive(message: MessageEvent);
32 respond(event: string, data?: object, runOnce?: boolean): void;
33 send(type: string, data?: any): void;
34 target(): Window | HTMLIFrameElement | ParentNode;
35}
\No newline at end of file