feat: migrate to Uint8Array

This commit is contained in:
Simon Chan 2022-02-23 23:09:56 +08:00
parent cb988f5563
commit 96b5807691
39 changed files with 429 additions and 752 deletions

View file

@ -24,7 +24,7 @@ const classNames = mergeStyleSets({
});
function serializePacket(packet: AdbPacketInit) {
const command = decodeUtf8(new Uint32Array([packet.command]).buffer);
const command = decodeUtf8(new Uint32Array([packet.command]));
const parts = [
command,
@ -35,7 +35,7 @@ function serializePacket(packet: AdbPacketInit) {
if (packet.payload) {
parts.push(
Array.from(
new Uint8Array(packet.payload),
packet.payload,
byte => byte.toString(16).padStart(2, '0')
).join(' ')
);