Skip to content

Latest commit

 

History

History
66 lines (40 loc) · 2.08 KB

API.md

File metadata and controls

66 lines (40 loc) · 2.08 KB

Table of Contents

initialize

Initialize the electron app to accept puppeteer/DevTools connections. Must be called at startup before the electron app is ready.

Parameters

  • app App The app imported from electron.
  • port number Port to host the DevTools websocket connection. (optional, default 0)

connect

Connects puppeteer to the electron app. Must call initialize before connecting. When connecting multiple times, you use the same port.

Parameters

  • app App The app imported from electron.
  • puppeteer puppeteer The imported puppeteer namespace.

Returns Promise<Browser> An object containing the puppeteer browser, the port, and json received from DevTools.

getPage

Given a BrowserWindow, find the corresponding puppeteer Page. It is undefined if external operations occur on the page whilst we are attempting to find it. A url/file must be loaded on the window for it to be found. If no url is loaded, the parameter 'allowBlankNavigate' allows us to load "about:blank" first.

Parameters

  • browser Browser The puppeteer browser instance obtained from calling |connect|.
  • window BrowserWindow The browser window for which we want to find the corresponding puppeteer Page.
  • allowBlankNavigate boolean If no url is loaded, allow us to load "about:blank" so that we may find the Page. (optional, default true)

Returns Promise<Page> The page that corresponds with the BrowserWindow.