diff options
| author | amankumarsingh77 <amankumarsingh7702@gmail.com> | 2026-07-28 22:01:47 +0530 |
|---|---|---|
| committer | Aman Kumar <145339995+amankumarsingh77@users.noreply.github.com> | 2026-08-02 19:12:46 +0530 |
| commit | c88082515dcd9c0df1328b85420e97d7286ad428 (patch) | |
| tree | d3a45084e5bea7473d6b6bcbe5163165c4368f64 /src/profile | |
| parent | 86045450c208bc51670dd9554e581f2a62b181c9 (diff) | |
refactor: attach and windowId become session methods
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) <noreply@anthropic.com>
Diffstat (limited to 'src/profile')
| -rw-r--r-- | src/profile/bind.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/profile/bind.ts b/src/profile/bind.ts index ca745ca..95cffaa 100644 --- a/src/profile/bind.ts +++ b/src/profile/bind.ts @@ -1,8 +1,6 @@ import type { BrowserClient } from "../client"; -import { attachTo } from "../cdp/attach"; import type { ResultOf } from "../cdp/commands"; import { type CdpError, cdpError } from "../cdp/errors"; -import { getWindowId } from "../cdp/window"; import { type Result, err, ok } from "../util/result"; import { detectRunningBrowser, resolveBrowserExecutable } from "./browser-process"; import { openProfileWindow } from "./launch"; @@ -79,10 +77,10 @@ export const seedProfileWindow = async ( const ownership = client.ownership(); ownership.setHarnessWindow(seed.targetId); ownership.add(seed.targetId); - const win = await getWindowId(client.session(), seed.targetId); + const win = await client.session().windowId(seed.targetId); if (win.success) ownership.setHarnessWindowId(win.data); - const attached = await attachTo(client.session(), seed.targetId); + const attached = await client.session().attach(seed.targetId); if (attached.success) { await client.session().callOnTarget("Page.navigate", { url: "about:blank" }, attached.data); } |
