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
open var listeners: ERROR CLASS: Symbol not found for js.objects.ReadonlyRecord<kotlin/String, ERROR CLASS: Symbol not found for js.array.ReadonlyArray<{tauri/apps/api/EventCallback<kotlin/Any?>=} kotlin/Function1<@R|kotlin/ParameterName|(name = String(event)) tauri/apps/api/Event<kotlin/Any?>, kotlin/Unit>>>

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
fun clearAllBrowsingData(): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Clears all browsing data for this webview.

Link copied to clipboard
fun close(): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Closes the webview.

Link copied to clipboard
fun <T> emit(event: String, payload: T = definedExternally): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

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

Link copied to clipboard
fun <T> emitTo(target: EventTarget, event: String, payload: T = definedExternally): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun <T> emitTo(target: String, event: String, payload: T = definedExternally): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

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

Link copied to clipboard
fun hide(): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Hide the webview.

Link copied to clipboard
open fun <T> listen(event: EventName, handler: EventCallback<T>): ERROR CLASS: Symbol not found for js.promise.Promise<{tauri/apps/api/UnlistenFn=} kotlin/Function0<kotlin/Unit>>

Listen to an emitted event on this webview.

Link copied to clipboard
open fun <T> once(event: EventName, handler: EventCallback<T>): ERROR CLASS: Symbol not found for js.promise.Promise<{tauri/apps/api/UnlistenFn=} kotlin/Function0<kotlin/Unit>>

Listen to an emitted event on this webview only once.

Link copied to clipboard
fun onDragDropEvent(handler: EventCallback<DragDropEvent>): ERROR CLASS: Symbol not found for js.promise.Promise<{tauri/apps/api/UnlistenFn=} kotlin/Function0<kotlin/Unit>>

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
fun position(): ERROR CLASS: Symbol not found for js.promise.Promise<tauri/apps/api/PhysicalPosition>

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): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun reparent(window: WebviewWindow): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun reparent(window: Window): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Moves this webview to the given label.

Link copied to clipboard
fun setAutoResize(autoResize: Boolean): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.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?): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Specify the webview background color.

Link copied to clipboard
fun setFocus(): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Bring the webview to front and focus.

Link copied to clipboard
fun setPosition(position: LogicalPosition): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun setPosition(position: PhysicalPosition): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun setPosition(position: Position): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Sets the webview position.

Link copied to clipboard
fun setSize(size: LogicalSize): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun setSize(size: PhysicalSize): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>
fun setSize(size: Size): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Resizes the webview.

Link copied to clipboard
fun setZoom(scaleFactor: Double): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Set webview zoom level.

Link copied to clipboard
fun show(): ERROR CLASS: Symbol not found for js.promise.Promise<ERROR CLASS: Symbol not found for js.core.Void>

Show the webview.

Link copied to clipboard
fun size(): ERROR CLASS: Symbol not found for js.promise.Promise<tauri/apps/api/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.