Skip to main content
This page documents shared TypeScript interfaces, enums, and event payload types used across the WebviewJS API. Import them alongside the classes you need:

Geometry types

These interfaces describe sizes, positions, and rectangular regions in logical or physical pixels. The API documentation for each method that uses these types specifies which coordinate space applies.

WebviewCookie represents a cookie stored in a webview’s session. Pass it to webview.setCookie() or receive it from webview.getCookies().

HTTP types

HeaderData

A key-value pair used in request and response headers throughout the custom protocol API.

CustomProtocolResponse

The return type for legacy custom-protocol handlers registered with win.registerProtocol(). You can also return a standard Fetch API Response object.

Monitor

Monitor describes a connected display as reported by the operating system. Retrieve monitors with win.getAvailableMonitors(), win.getCurrentMonitor(), win.getPrimaryMonitor(), or win.getMonitorFromPoint(x, y).
VideoMode describes a single display configuration available for the monitor, useful when entering exclusive fullscreen:

IPC

IpcMessage is the object received by webview.onIpcMessage() whenever page JavaScript calls window.ipc.postMessage().

Application events

ApplicationEvent

The payload type for all events emitted by app.on(...).
event is one of "ready", "window-close-requested", "application-close-requested", or "custom-menu-click". The WebviewApplicationEvent enum is a numeric compatibility export; current event payloads use the string names. customMenuEvent is present for "custom-menu-click".

CustomMenuEvent


Enums

WebviewApplicationEvent

Provides numeric compatibility constants for the string event names delivered to app.on(...) listeners. Compare the payload’s event field with its string value in new code.

Theme

Controls or reports the colour scheme of a window or webview.

FullscreenType

Passed to win.setFullscreen() to choose the fullscreen strategy.

ProgressBarState

Passed inside a JsProgressBar object to win.setProgressBar() to update the platform’s progress indicator.

CursorType

Pass a CursorType value to win.setCursor() to change the mouse cursor shape over the window.

Window event types

BrowserWindowEventMap maps event name strings to their typed payload interfaces. Register listeners with win.on(eventName, handler). The native payload can omit cursor coordinates for mouse-enter, mouse-down, and mouse-up when no prior cursor position is available. Check for undefined before using them. Each file-drop and file-hover payload currently contains one path; multiple files arrive as separate native events.

Webview event types

WebviewEventMap maps webview event names to their typed payloads. Register listeners with webview.on(eventName, handler).

Application event types

ApplicationEventMap maps application event names to their payloads. Register listeners with app.on(eventName, handler).

SerializationError

SerializationError is a subclass of Error with name === "SerializationError". The webview.expose() helper uses JSON serialization for static values, function arguments, and return values. Cyclic values, BigInt, Symbol, and an undefined top-level value cannot be serialized. Map and Set follow normal JSON.stringify behavior, usually becoming {}; nested undefined properties are omitted.

WebContextOptions

WebContextOptions is passed to app.createWebContext() to configure an isolated browsing context for one or more webviews. Webviews that share a WebContext also share their cookie store and cache.
See the WebContext reference for full details on context sharing and disposal.