feat(adb): add AdbServerClient.prototype.createAdb()

as a shorthand for `createTransport` and `new Adb`
This commit is contained in:
Simon Chan 2025-06-02 21:42:41 +08:00
parent 798b136f40
commit dbcfd34c03
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
"@yume-chan/adb": patch
---
Add `AdbServerClient.prototype.createAdb()` as a shorthand for `createTransport` and `new Adb`

View file

@ -12,6 +12,7 @@ import type {
import { AbortController } from "@yume-chan/stream-extra";
import type { AdbIncomingSocketHandler, AdbSocket, Closeable } from "../adb.js";
import { Adb } from "../adb.js";
import { AdbBanner } from "../banner.js";
import type { DeviceObserver as DeviceObserverBase } from "../device-observer.js";
import type { AdbFeature } from "../features.js";
@ -466,6 +467,11 @@ export class AdbServerClient {
return transport;
}
async createAdb(device: AdbServerClient.DeviceSelector) {
const transport = await this.createTransport(device);
return new Adb(transport);
}
}
export async function raceSignal<T>(