From c88082515dcd9c0df1328b85420e97d7286ad428 Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 22:01:47 +0530 Subject: refactor: attach and windowId become session methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cdp/attach.ts and cdp/window.ts were a module each for a single `map(await session.callBrowser(...))` one-liner that took the session as its first argument — two files, two imports and two names for what the session can expose itself. They are now session.attach(targetId) and session.windowId(targetId). session.ts also repeated `targetId ? tabs.get(targetId) : undefined` eight times; that is now currentTab(). Co-Authored-By: Claude Opus 5 (1M context) --- src/cdp/window.ts | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 src/cdp/window.ts (limited to 'src/cdp/window.ts') diff --git a/src/cdp/window.ts b/src/cdp/window.ts deleted file mode 100644 index b06f1ac..0000000 --- a/src/cdp/window.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { map, type Result } from "../util/result"; -import type { CdpError } from "./errors"; -import type { CdpSession } from "./session"; - -export const getWindowId = async ( - session: CdpSession, - targetId: string, -): Promise> => - map(await session.callBrowser("Browser.getWindowForTarget", { targetId }), (d) => d.windowId); -- cgit v1.2.3