File size: 984 Bytes
fc93158 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import { danger } from "../globals.js";
import { defaultRuntime } from "../runtime.js";
import { callBrowserResize, type BrowserParentOpts } from "./browser-cli-shared.js";
export async function runBrowserResizeWithOutput(params: {
parent: BrowserParentOpts;
profile?: string;
width: number;
height: number;
targetId?: string;
timeoutMs?: number;
successMessage: string;
}): Promise<void> {
const { width, height } = params;
if (!Number.isFinite(width) || !Number.isFinite(height)) {
defaultRuntime.error(danger("width and height must be numbers"));
defaultRuntime.exit(1);
return;
}
const result = await callBrowserResize(
params.parent,
{
profile: params.profile,
width,
height,
targetId: params.targetId,
},
{ timeoutMs: params.timeoutMs ?? 20000 },
);
if (params.parent?.json) {
defaultRuntime.log(JSON.stringify(result, null, 2));
return;
}
defaultRuntime.log(params.successMessage);
}
|