MCPcopy
hub / github.com/yume-chan/ya-webadb / ClipboardStream

Class ClipboardStream

libraries/scrcpy/src/1_15/impl/clipboard-stream.ts:13–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11);
12
13export class ClipboardStream
14 extends PushReadableStream<string>
15 implements ScrcpyDeviceMessageParser
16{
17 #controller: PushReadableStreamController<string>;
18
19 readonly id = 0;
20
21 constructor() {
22 let controller!: PushReadableStreamController<string>;
23 super((controller_) => {
24 controller = controller_;
25 });
26 this.#controller = controller;
27 }
28
29 async parse(_id: number, stream: AsyncExactReadable): Promise<undefined> {
30 const message = await ClipboardDeviceMessage.deserialize(stream);
31 await this.#controller.enqueue(message.content);
32 }
33
34 close() {
35 this.#controller.close();
36 }
37
38 error(e?: unknown) {
39 this.#controller.error(e);
40 }
41}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected