Home Reference Source Test
import PuppeteerBrowser from 'puppeteer-browser/source/index.js'
public class | source

PuppeteerBrowser

Wrapper of Puppeteer class

Static Member Summary

Static Public Members
public static get
public static get

Static Method Summary

Static Public Methods
public static
public static

async getPage(root: string, path: string, fileChange: function): Page

public static

async launch(options: Object): Browser

public static

watch(path: string, onChange: function): FSWatcher

After files changed, the page will be focused & reloaded

Static Protected Methods
protected static

async getBrowser(visible: boolean): Browser

protected static

async getServer(root: string): Object

Static Public Members

public static get browserName: string source

public static get moduleName: string source

Static Public Methods

public static async getPage(root: string, path: string, fileChange: function): Page source

Params:

NameTypeAttributeDescription
root string
  • nullable: true

Root path to start Web server, default to be process.cwd()

path string
  • nullable: true

Path to open Web page

fileChange function
  • optional

Do something between files changed & page reload (Browser will be visible)

Return:

Page

Resolve after DOMContentLoaded event fired

Test:

public static async launch(options: Object): Browser source

Params:

NameTypeAttributeDescription
options Object
  • optional

https://pptr.dev/#?product=Puppeteer&version=v1.5.0&show=api-puppeteerlaunchoptions

Return:

Browser

public static watch(path: string, onChange: function): FSWatcher source

After files changed, the page will be focused & reloaded

Params:

NameTypeAttributeDescription
path string

Directory to watch recursively

onChange function

Call on files changed

Return:

FSWatcher

Test:

Static Protected Methods

protected static async getBrowser(visible: boolean): Browser source

Params:

NameTypeAttributeDescription
visible boolean
  • optional

Browser visibility (Visible mode will run slowly for seeing clearly)

Return:

Browser

Test:

protected static async getServer(root: string): Object source

Params:

NameTypeAttributeDescription
root string
  • optional

Root path of the static site

Return:

Object

Server information