-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathdebug-service-base.ts
29 lines (22 loc) · 1.05 KB
/
debug-service-base.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { EventEmitter } from "events";
export abstract class DebugServiceBase extends EventEmitter implements IPlatformDebugService {
constructor(protected $devicesService: Mobile.IDevicesService) { super(); }
public abstract get platform(): string;
public abstract async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise<string>;
public abstract async debugStart(debugData: IDebugData, debugOptions: IDebugOptions): Promise<void>;
public abstract async debugStop(): Promise<void>;
protected getCanExecuteAction(deviceIdentifier: string): (device: Mobile.IDevice) => boolean {
return (device: Mobile.IDevice): boolean => {
if (deviceIdentifier) {
let isSearchedDevice = device.deviceInfo.identifier === deviceIdentifier;
if (!isSearchedDevice) {
const deviceByDeviceOption = this.$devicesService.getDeviceByDeviceOption();
isSearchedDevice = deviceByDeviceOption && device.deviceInfo.identifier === deviceByDeviceOption.deviceInfo.identifier;
}
return isSearchedDevice;
} else {
return true;
}
};
}
}