diff options
author | 2023-08-26 18:26:50 -0700 | |
---|---|---|
committer | 2023-08-26 18:26:50 -0700 | |
commit | eeeef5aaf05c832ccc4e6de6781f1924a5893808 (patch) | |
tree | 8b1283bd79d0e17a850717c9a88d668fb0c2c21d /packages/bun-inspector-protocol/src/inspector/index.d.ts | |
parent | f9b966c13f5ed3d870c54b69cb59a5adc12060b7 (diff) | |
download | bun-dap3.tar.gz bun-dap3.tar.zst bun-dap3.zip |
Terminal works, launch is being reworkeddap3
Diffstat (limited to 'packages/bun-inspector-protocol/src/inspector/index.d.ts')
-rw-r--r-- | packages/bun-inspector-protocol/src/inspector/index.d.ts | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/packages/bun-inspector-protocol/src/inspector/index.d.ts b/packages/bun-inspector-protocol/src/inspector/index.d.ts index 7080f1dba..00c000189 100644 --- a/packages/bun-inspector-protocol/src/inspector/index.d.ts +++ b/packages/bun-inspector-protocol/src/inspector/index.d.ts @@ -1,10 +1,23 @@ -import type { JSC } from ".."; +import type { EventEmitter } from "node:events"; +import type { JSC } from "../protocol"; + +export type InspectorEventMap = { + [E in keyof JSC.EventMap]: [JSC.EventMap[E]]; +} & { + "Inspector.connecting": [string]; + "Inspector.connected": []; + "Inspector.disconnected": [Error | undefined]; + "Inspector.error": [Error]; + "Inspector.pendingRequest": [JSC.Request]; + "Inspector.request": [JSC.Request]; + "Inspector.response": [JSC.Response]; + "Inspector.event": [JSC.Event]; +}; /** * A client that can send and receive messages to/from a debugger. */ -export abstract class Inspector { - constructor(listener?: InspectorListener); +export interface Inspector extends EventEmitter<InspectorEventMap> { /** * Starts the inspector. */ @@ -17,11 +30,6 @@ export abstract class Inspector { 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; @@ -30,20 +38,3 @@ export abstract class 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; -}; |