UNPKG

@yume-chan/adb-scrcpy

Version:

Use `@yume-chan/adb` to bootstrap `@yume-chan/scrcpy`.

51 lines (41 loc) 1.55 kB
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb"; import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy"; import { ScrcpyOptions3_0_1 } from "@yume-chan/scrcpy"; import { createConnection, getDisplays, getEncoders, } from "./2_1/impl/index.js"; import type { AdbScrcpyClientOptions } from "./client-options.js"; import type { AdbScrcpyConnection } from "./connection.js"; import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js"; export class AdbScrcpyOptions3_0_1<TVideo extends boolean> extends ScrcpyOptions3_0_1<TVideo> implements AdbScrcpyOptions<ScrcpyOptions3_0_1.Init<TVideo>>, AdbScrcpyOptionsGetEncoders { readonly version: string; readonly spawner: AdbNoneProtocolSpawner | undefined; constructor( init: ScrcpyOptions3_0_1.Init<TVideo>, clientOptions?: AdbScrcpyClientOptions, ) { super(init); this.version = clientOptions?.version ?? "3.0.1"; this.spawner = clientOptions?.spawner; } getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> { return getEncoders(adb, path, this); } getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> { return getDisplays(adb, path, this); } createConnection(adb: Adb): AdbScrcpyConnection { return createConnection(adb, this.value); } } export namespace AdbScrcpyOptions3_0_1 { export type Init<TVideo extends boolean = boolean> = ScrcpyOptions3_0_1.Init<TVideo>; }