aboutsummaryrefslogtreecommitdiff
path: root/src/cdp/attach.ts
blob: c1b101b00166938d40daf4647354f26ed93b2750 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { map, type Result } from "../util/result";
import type { CdpError } from "./errors";
import type { CdpSession } from "./session";

export const attachTo = async (
  session: CdpSession,
  targetId: string,
): Promise<Result<string, CdpError>> =>
  map(
    await session.callBrowser("Target.attachToTarget", { targetId, flatten: true }),
    (d) => d.sessionId,
  );