blob: 4baf4ddc03244638f7cb62abd92a01fc7c3088ad (
plain) (
blame)
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
|
import type { JSC } from "..";
/**
* A client that can send and receive messages to/from a debugger.
*/
export abstract class Inspector {
constructor(listener?: InspectorListener);
/**
* Starts the inspector.
*/
start(...args: unknown[]): void;
/**
* Sends a request to the debugger.
*/
send<M extends keyof JSC.RequestMap & keyof JSC.ResponseMap>(
method: M,
params?: JSC.RequestMap[M],
): Promise<JSC.ResponseMap[M]>;
/**
* Accepts a message from the debugger.
* @param message the unparsed message from the debugger
*/
accept(message: string): void;
/**
* If the inspector is closed.
*/
get closed(): boolean;
/**
* Closes the inspector.
*/
close(...args: unknown[]): void;
}
export type InspectorListener = {
/**
* Defines a handler when a debugger event is received.
*/
[M in keyof JSC.EventMap]?: (event: JSC.EventMap[M]) => void;
} & {
/**
* Defines a handler when the debugger is connected or reconnected.
*/
["Inspector.connected"]?: () => void;
/**
* Defines a handler when the debugger is disconnected.
* @param error the error that caused the disconnect, if any
*/
["Inspector.disconnected"]?: (error?: Error) => void;
};
|