Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
miherlosev committed Jun 20, 2020
1 parent 83452d9 commit 418f07d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions @types/chrome-remote-interface/index.d.ts
Expand Up @@ -9,22 +9,22 @@ declare module 'chrome-remote-interface' {
}

export interface GenericConnectionOptions {
port: number
port: number;
}

export interface ConstructorOptions extends GenericConnectionOptions {
target: TargetInfo
target: TargetInfo;
}

export interface CloseTabOptions extends GenericConnectionOptions {
id: TargetInfo['id']
id: TargetInfo['id'];
}
}

interface ChromeRemoteInterface {
(options: chromeRemoteInterface.ConstructorOptions): Promise<chromeRemoteInterface.ProtocolApi>;
listTabs (options: chromeRemoteInterface.GenericConnectionOptions): Promise<chromeRemoteInterface.TargetInfo[]>;
closeTab (options: chromeRemoteInterface.CloseTabOptions): Promise<void>
List (options: chromeRemoteInterface.GenericConnectionOptions): Promise<chromeRemoteInterface.TargetInfo[]>;
Close (options: chromeRemoteInterface.CloseTabOptions): Promise<void>;
}

const chromeRemoteInterface: ChromeRemoteInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/browser/provider/built-in/dedicated/chrome/cdp.ts
Expand Up @@ -45,7 +45,7 @@ interface TouchConfigOptions {
const DOWNLOADS_DIR = path.join(os.homedir(), 'Downloads');

async function getActiveTab (cdpPort: number, browserId: string): Promise<remoteChrome.TargetInfo> {
const tabs = await remoteChrome.listTabs({ port: cdpPort });
const tabs = await remoteChrome.List({ port: cdpPort });

return tabs.filter(t => t.type === 'page' && t.url.includes(browserId))[0];
}
Expand Down Expand Up @@ -173,7 +173,7 @@ export function isHeadlessTab ({ tab, config }: RuntimeInfo): boolean {
}

export async function closeTab ({ tab, cdpPort }: RuntimeInfo): Promise<void> {
await remoteChrome.closeTab({ id: tab.id, port: cdpPort });
await remoteChrome.Close({ id: tab.id, port: cdpPort });
}

export async function updateMobileViewportSize (runtimeInfo: RuntimeInfo): Promise<void> {
Expand Down

0 comments on commit 418f07d

Please sign in to comment.