1 | import { AnyAction } from './actions/types';
|
2 | import { TransportDispatch } from './client';
|
3 | declare global {
|
4 | interface Window {
|
5 | SmartWebView: {
|
6 | handleMessage: (message: String, data?: String) => void;
|
7 | };
|
8 | }
|
9 | }
|
10 | export declare enum Context {
|
11 | Modal = "Modal",
|
12 | Main = "Main"
|
13 | }
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export declare type HandlerData = {
|
19 | data: AnyAction;
|
20 | };
|
21 |
|
22 |
|
23 |
|
24 | export declare type Handler = (event: MessageEvent) => void;
|
25 |
|
26 |
|
27 |
|
28 | export interface MessageTransport {
|
29 | dispatch(message: TransportDispatch): void;
|
30 | hostFrame: Window;
|
31 | localOrigin: string;
|
32 | subscribe(handler: Handler): () => void;
|
33 | }
|
34 | export interface ContextualMessageTransport extends MessageTransport {
|
35 | context: Context;
|
36 | frameWindow: Window | null;
|
37 | dispatch(message: any): void;
|
38 | }
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | export declare function fromFrame(frame: HTMLIFrameElement, localOrigin: string, context: Context): ContextualMessageTransport;
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | export declare function fromWindow(contentWindow: Window, localOrigin: string): MessageTransport;
|