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: string): WebviewWindowHandle

Parameters:#

NameType
labelstring

Returns: WebviewWindowHandle

Defined in: window.ts:128

Properties#

label#

label: string

Window label.

Defined in: window.ts:126


listeners#

listeners: object

Local event listeners.

Type declaration:#

Defined in: window.ts:128

Methods#

_handleTauriEvent#

_handleTauriEvent<T>(event: string, handler: EventCallback<T>): boolean

Type parameters:#

Name
T

Parameters:#

NameType
eventstring
handlerEventCallback<T>

Returns: boolean

Defined in: window.ts:192


emit#

emit(event: string, payload?: string): 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:181


listen#

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

Listen to an 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:143


once#

once<T>(event: string, handler: EventCallback<T>): 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:164