Webview

open external class Webview(source)

Create new webview or get a handle to an existing one.

Webviews are identified by a label a unique identifier that can be used to reference it later. It may only contain alphanumeric characters a-zA-Z plus the following special characters -, /, : and _.

Since

2.0.0

Inheritors

Constructors

Link copied to clipboard
constructor(window: Window, label: WebviewLabel, options: WebviewOptions)

Creates a new Webview.

Types

Link copied to clipboard
external object Companion

Properties

Link copied to clipboard
open external var label: WebviewLabel

The webview label. It is a unique identifier for the webview, can be used to reference it later.

Link copied to clipboard

Local event listeners.

Link copied to clipboard
external var window: Window

The window hosting this webview.

Functions

Link copied to clipboard
external fun <T> _handleTauriEvent(event: String, handler: EventCallback<T>): Boolean
Link copied to clipboard

Clears all browsing data for this webview.

Link copied to clipboard
external fun close(): Promise<Void>

Closes the webview.

Link copied to clipboard
external fun <T> emit(event: String, payload: T = definedExternally): Promise<Void>

Emits an event to all {@link EventTarget|targets}.

Link copied to clipboard
external fun <T> emitTo(target: EventTarget, event: String, payload: T = definedExternally): Promise<Void>
external fun <T> emitTo(target: String, event: String, payload: T = definedExternally): Promise<Void>

Emits an event to all {@link EventTarget|targets} matching the given target.

Link copied to clipboard
external fun hide(): Promise<Void>

Hide the webview.

Link copied to clipboard
open external fun <T> listen(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>

Listen to an emitted event on this webview.

Link copied to clipboard
open external fun <T> once(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>

Listen to an emitted event on this webview only once.

Link copied to clipboard

Listen to a file drop event. The listener is triggered when the user hovers the selected files on the webview, drops the files or cancels the operation.

Link copied to clipboard

The position of the top-left hand corner of the webview's client area relative to the top-left hand corner of the desktop.

Link copied to clipboard
external fun reparent(window: String): Promise<Void>
external fun reparent(window: WebviewWindow): Promise<Void>
external fun reparent(window: Window): Promise<Void>

Moves this webview to the given label.

Link copied to clipboard
external fun setAutoResize(autoResize: Boolean): Promise<Void>

Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes.

Link copied to clipboard
open external fun setBackgroundColor(color: Color?): Promise<Void>

Specify the webview background color.

Link copied to clipboard
external fun setFocus(): Promise<Void>

Bring the webview to front and focus.

Link copied to clipboard
external fun setPosition(position: LogicalPosition): Promise<Void>
external fun setPosition(position: PhysicalPosition): Promise<Void>
external fun setPosition(position: Position): Promise<Void>

Sets the webview position.

Link copied to clipboard
external fun setSize(size: LogicalSize): Promise<Void>
external fun setSize(size: PhysicalSize): Promise<Void>
external fun setSize(size: Size): Promise<Void>

Resizes the webview.

Link copied to clipboard
external fun setZoom(scaleFactor: Double): Promise<Void>

Set webview zoom level.

Link copied to clipboard
external fun show(): Promise<Void>

Show the webview.

Link copied to clipboard
external fun size(): Promise<PhysicalSize>

The physical size of the webview's client area. The client area is the content of the webview, excluding the title bar and borders.