Bun

interface

WebView.ConstructorOptions

interface ConstructorOptions

  • backend?: Backend

    Browser backend. Defaults to "webkit" on macOS, throws on other platforms unless "chrome" is specified.

  • console?: ConsoleCapture

    Capture page-side console.* calls. See ConsoleCapture.

  • dataStore?: 'ephemeral' | { directory: string }

    Storage backing for cookies, localStorage, IndexedDB, etc.

    • "ephemeral" (default): in-memory only, nothing written to disk.
    • { directory }: persistent storage rooted at the given path. Multiple views with the same directory share state.

    Chrome backend: directory is per-Chrome-process (--user-data-dir), not per-view. The first view's directory applies to all views spawned in the same Bun process.

  • headless?: boolean

    Only true (headless) is implemented.

  • height?: number

    Viewport height in pixels. Range: [1, 16384].

  • url?: string

    Initial URL to navigate to. The navigation starts before the constructor returns; await view.navigate(otherUrl) or any other operation will wait for it to complete first.

    Equivalent to calling view.navigate(url) immediately after construction.

  • width?: number

    Viewport width in pixels. Range: [1, 16384].