src/cdp/attach.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import { map, type Result } from "../util/result";
import type { CdpError } from "./errors";
import type { CdpSession } from "./session";
/** Target.attachToTarget, unwrapped to the new session id. */
export const attachTo = async (
session: CdpSession,
targetId: string,
): Promise<Result<string, CdpError>> =>
map(
await session.callBrowser("Target.attachToTarget", { targetId, flatten: true }),
(d) => d.sessionId,
);
|