|
5 | 5 | * LICENSE file in the root directory of this source tree.
|
6 | 6 | */
|
7 | 7 |
|
8 |
| -export type MessagePayload = |
9 |
| - | null |
10 |
| - | string |
11 |
| - | number |
12 |
| - | boolean |
13 |
| - | {[key: string]: MessagePayload} |
14 |
| - | MessagePayload[]; |
15 |
| -export type Message = {event: string; payload?: MessagePayload}; |
| 8 | +export type MessagePayload = null | string | number | boolean | { [key: string]: MessagePayload } | MessagePayload[]; |
| 9 | +export type Message = { event: string, payload?: MessagePayload }; |
16 | 10 |
|
17 | 11 | export type WallListener = (message: Message) => void;
|
18 | 12 | export type Wall = {
|
19 |
| - listen: (fn: WallListener) => Function; |
20 |
| - send: (event: string, payload?: MessagePayload) => void; |
| 13 | + listen: (fn: WallListener) => Function, |
| 14 | + send: (event: string, payload?: MessagePayload) => void, |
21 | 15 | };
|
22 | 16 |
|
23 | 17 | export type Bridge = {
|
24 |
| - shutdown: () => void; |
| 18 | + shutdown: () => void, |
25 | 19 | };
|
26 | 20 | export type Store = Object;
|
27 | 21 | export type BrowserTheme = 'dark' | 'light';
|
28 | 22 |
|
29 | 23 | export function createBridge(wall: Wall): Bridge;
|
30 | 24 | export function createStore(bridge: Bridge): Store;
|
31 | 25 |
|
| 26 | +export type ViewElementSource = ( |
| 27 | + source: Source, |
| 28 | + symbolicatedSource: Source | null, |
| 29 | +) => void; |
| 30 | +export type ViewAttributeSource = ( |
| 31 | + id: number, |
| 32 | + path: Array<string | number>, |
| 33 | +) => void; |
| 34 | +export type CanViewElementSource = ( |
| 35 | + source: Source, |
| 36 | + symbolicatedSource: Source | null, |
| 37 | +) => boolean; |
| 38 | + |
32 | 39 | export type InitializationOptions = {
|
33 |
| - bridge: Bridge; |
34 |
| - store: Store; |
35 |
| - theme?: BrowserTheme; |
| 40 | + bridge: Bridge, |
| 41 | + store: Store, |
| 42 | + theme?: BrowserTheme, |
| 43 | + viewAttributeSourceFunction?: ViewAttributeSource, |
| 44 | + viewElementSourceFunction?: ViewElementSource, |
| 45 | + canViewElementSourceFunction?: CanViewElementSource, |
36 | 46 | };
|
37 |
| -export function initialize( |
38 |
| - node: Element | Document, |
39 |
| - options: InitializationOptions, |
40 |
| -): void; |
| 47 | + |
| 48 | +export function initialize(node: Element | Document, options: InitializationOptions): void; |
0 commit comments