|
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 Source = { |
| 27 | + sourceURL: string, |
| 28 | + line: number, |
| 29 | + column: number, |
| 30 | +}; |
| 31 | +export type ViewElementSource = ( |
| 32 | + source: Source, |
| 33 | + symbolicatedSource: Source | null, |
| 34 | +) => void; |
| 35 | +export type ViewAttributeSource = ( |
| 36 | + id: number, |
| 37 | + path: Array<string | number>, |
| 38 | +) => void; |
| 39 | +export type CanViewElementSource = ( |
| 40 | + source: Source, |
| 41 | + symbolicatedSource: Source | null, |
| 42 | +) => boolean; |
| 43 | + |
32 | 44 | export type InitializationOptions = { |
33 | | - bridge: Bridge; |
34 | | - store: Store; |
35 | | - theme?: BrowserTheme; |
| 45 | + bridge: Bridge, |
| 46 | + store: Store, |
| 47 | + theme?: BrowserTheme, |
| 48 | + viewAttributeSourceFunction?: ViewAttributeSource, |
| 49 | + viewElementSourceFunction?: ViewElementSource, |
| 50 | + canViewElementSourceFunction?: CanViewElementSource, |
36 | 51 | }; |
37 | | -export function initialize( |
38 | | - node: Element | Document, |
39 | | - options: InitializationOptions, |
40 | | -): void; |
| 52 | + |
| 53 | +export function initialize(node: Element | Document, options: InitializationOptions): void; |
0 commit comments