Files
archived-tauri-docs/docs/api/js/classes/window.WebviewWindowHandle.md
2022-03-29 07:36:52 +02:00

3.7 KiB

@tauri-apps/api / window / WebviewWindowHandle

Class: WebviewWindowHandle

window.WebviewWindowHandle

A webview window handle allows emitting and listening to events from the backend that are tied to the window.

Hierarchy

Constructors

constructor

new WebviewWindowHandle(label)

Parameters

Name Type
label string

Defined in

window.ts:254

Properties

label

label: string

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

Defined in

window.ts:250


listeners

listeners: Object

Local event listeners.

Index signature

▪ [key: string]: EventCallback<any>[]

Defined in

window.ts:252

Methods

_handleTauriEvent

_handleTauriEvent<T>(event, handler): boolean

Type parameters

Name
T

Parameters

Name Type
event string
handler EventCallback<T>

Returns

boolean

Defined in

window.ts:316


emit

emit(event, payload?): Promise<void>

Emits an event to the backend, tied to the webview window.

Parameters

Name Type Description
event string Event name. Must include only alphanumeric characters, -, /, : and _.
payload? unknown Event payload.

Returns

Promise<void>

Defined in

window.ts:305


listen

listen<T>(event, handler): Promise<UnlistenFn>

Listen to an event emitted by the backend that is tied to the webview window.

Type parameters

Name
T

Parameters

Name Type Description
event EventName Event name. Must include only alphanumeric characters, -, /, : and _.
handler EventCallback<T> Event handler.

Returns

Promise<UnlistenFn>

A promise resolving to a function to unlisten to the event.

Defined in

window.ts:267


once

once<T>(event, handler): Promise<UnlistenFn>

Listen to an one-off event emitted by the backend that is tied to the webview window.

Type parameters

Name
T

Parameters

Name Type Description
event string Event name. Must include only alphanumeric characters, -, /, : and _.
handler EventCallback<T> Event handler.

Returns

Promise<UnlistenFn>

A promise resolving to a function to unlisten to the event.

Defined in

window.ts:288