@yume-chan/scrcpy
Version:
TypeScript implementation of Scrcpy client.
23 lines • 656 B
JavaScript
/**
* Scrcpy control message types have different values between versions.
*
* This class provides a way to get the actual value for a given type.
*/
export class ScrcpyControlMessageTypeMap {
#types;
constructor(options) {
this.#types = options.controlMessageTypes;
}
get(type) {
const value = this.#types.indexOf(type);
if (value === -1) {
throw new TypeError("Invalid or unsupported control message type");
}
return value;
}
fillMessageType(message, type) {
message.type = this.get(type);
return message;
}
}
//# sourceMappingURL=message-type-map.js.map