mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 09:49:24 +02:00
feat(adb): add AdbServerClient.prototype.createAdb()
as a shorthand for `createTransport` and `new Adb`
This commit is contained in:
parent
798b136f40
commit
dbcfd34c03
2 changed files with 11 additions and 0 deletions
5
.changeset/spicy-memes-behave.md
Normal file
5
.changeset/spicy-memes-behave.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@yume-chan/adb": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add `AdbServerClient.prototype.createAdb()` as a shorthand for `createTransport` and `new Adb`
|
|
@ -12,6 +12,7 @@ import type {
|
||||||
import { AbortController } from "@yume-chan/stream-extra";
|
import { AbortController } from "@yume-chan/stream-extra";
|
||||||
|
|
||||||
import type { AdbIncomingSocketHandler, AdbSocket, Closeable } from "../adb.js";
|
import type { AdbIncomingSocketHandler, AdbSocket, Closeable } from "../adb.js";
|
||||||
|
import { Adb } from "../adb.js";
|
||||||
import { AdbBanner } from "../banner.js";
|
import { AdbBanner } from "../banner.js";
|
||||||
import type { DeviceObserver as DeviceObserverBase } from "../device-observer.js";
|
import type { DeviceObserver as DeviceObserverBase } from "../device-observer.js";
|
||||||
import type { AdbFeature } from "../features.js";
|
import type { AdbFeature } from "../features.js";
|
||||||
|
@ -466,6 +467,11 @@ export class AdbServerClient {
|
||||||
|
|
||||||
return transport;
|
return transport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createAdb(device: AdbServerClient.DeviceSelector) {
|
||||||
|
const transport = await this.createTransport(device);
|
||||||
|
return new Adb(transport);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function raceSignal<T>(
|
export async function raceSignal<T>(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue