refactor(scrcpy): rewrite option classes to improve tree-shaking

This commit is contained in:
Simon Chan 2024-11-27 14:43:33 +08:00
parent 92472007db
commit cc5d52912e
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
63 changed files with 595 additions and 325 deletions

View file

@ -6,17 +6,19 @@ import type {
AndroidKeyEventAction,
AndroidKeyEventMeta,
} from "../android/index.js";
import { ScrcpyControlMessageType } from "../base/index.js";
export const ScrcpyInjectKeyCodeControlMessage = struct(
{
type: u8,
action: u8<AndroidKeyEventAction>(),
keyCode: u32<AndroidKeyCode>(),
repeat: u32,
metaState: u32<AndroidKeyEventMeta>(),
},
{ littleEndian: false },
);
export const ScrcpyInjectKeyCodeControlMessage = /* #__PURE__ */ (() =>
struct(
{
type: u8(ScrcpyControlMessageType.InjectKeyCode),
action: u8<AndroidKeyEventAction>(),
keyCode: u32<AndroidKeyCode>(),
repeat: u32,
metaState: u32<AndroidKeyEventMeta>(),
},
{ littleEndian: false },
))();
export type ScrcpyInjectKeyCodeControlMessage = StructInit<
typeof ScrcpyInjectKeyCodeControlMessage