diff options
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/inspector.ts | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/ext/node/polyfills/inspector.ts b/ext/node/polyfills/inspector.ts index 12ec05021..9de86ab14 100644 --- a/ext/node/polyfills/inspector.ts +++ b/ext/node/polyfills/inspector.ts @@ -1,26 +1,18 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. -// TODO(petamoriken): enable prefer-primordials for node polyfills -// deno-lint-ignore-file prefer-primordials - import { EventEmitter } from "node:events"; import { notImplemented } from "ext:deno_node/_utils.ts"; +import { primordials } from "ext:core/mod.js"; -const connectionSymbol = Symbol("connectionProperty"); -const messageCallbacksSymbol = Symbol("messageCallbacks"); -const nextIdSymbol = Symbol("nextId"); -const onMessageSymbol = Symbol("onMessage"); +const { + SafeMap, +} = primordials; class Session extends EventEmitter { - [connectionSymbol]: null; - [nextIdSymbol]: number; - [messageCallbacksSymbol]: Map<string, (e: Error) => void>; - - constructor() { - super(); - notImplemented("inspector.Session.prototype.constructor"); - } + #connection = null; + #nextId = 1; + #messageCallbacks = new SafeMap(); /** Connects the session to the inspector back-end. */ connect() { @@ -33,10 +25,6 @@ class Session extends EventEmitter { notImplemented("inspector.Session.prototype.connectToMainThread"); } - [onMessageSymbol](_message: string) { - notImplemented("inspector.Session.prototype[Symbol('onMessage')]"); - } - /** Posts a message to the inspector back-end. */ post( _method: string, |