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
object Companion

Properties

Link copied to clipboard

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

The window hosting this webview.

Functions

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

Clears all browsing data for this webview.

Link copied to clipboard

Closes the webview.

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

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

Link copied to clipboard
fun <T> emitTo(target: EventTarget, event: String, payload: T = definedExternally): Promise<Void>
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
fun hide(): Promise<Void>

Hide the webview.

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

Listen to an emitted event on this webview.

Link copied to clipboard
open 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
fun reparent(window: String): Promise<Void>
fun reparent(window: Window): Promise<Void>

Moves this webview to the given label.

Link copied to clipboard
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 fun setBackgroundColor(color: Color?): Promise<Void>

Specify the webview background color.

Link copied to clipboard

Bring the webview to front and focus.

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

Sets the webview position.

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

Resizes the webview.

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

Set webview zoom level.

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

Show the webview.

Link copied to clipboard

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