Skip to main content

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#

NameType
labelWindowLabel

Defined in#

window.ts:233

Properties#

label#

label: WindowLabel

Window label.

Defined in#

window.ts:229


listeners#

listeners: Object

Local event listeners.

Index signature#

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

Defined in#

window.ts:231

Methods#

_handleTauriEvent#

_handleTauriEvent<T>(event, handler): boolean

Type parameters#

Name
T

Parameters#

NameType
eventstring
handlerEventCallback<T>

Returns#

boolean

Defined in#

window.ts:295


emit#

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

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

Parameters#

NameTypeDescription
eventstringEvent name.
payload?stringEvent payload.

Returns#

Promise<void>

Defined in#

window.ts:284


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#

NameTypeDescription
eventEventNameEvent name.
handlerEventCallback<T>Event handler.

Returns#

Promise<UnlistenFn>

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

Defined in#

window.ts:246


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#

NameTypeDescription
eventstringEvent name.
handlerEventCallback<T>Event handler.

Returns#

Promise<UnlistenFn>

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

Defined in#

window.ts:267