| 11 | ); |
| 12 | |
| 13 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected