window.WebviewWindowHandle
A webview window handle allows emitting and listening to events from the backend that are tied to the window.
Hierarchy#
WebviewWindowHandle
Constructors#
constructor#
• new WebviewWindowHandle(label)
Parameters#
| Name | Type |
|---|---|
label | WindowLabel |
Defined in#
Properties#
label#
• label: WindowLabel
Window label.
Defined in#
listeners#
• listeners: Object
Local event listeners.
Index signature#
▪ [key: string]: EventCallback<any>[]
Defined in#
Methods#
_handleTauriEvent#
▸ _handleTauriEvent<T>(event, handler): boolean
Type parameters#
| Name |
|---|
T |
Parameters#
| Name | Type |
|---|---|
event | string |
handler | EventCallback<T> |
Returns#
boolean
Defined in#
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. |
payload? | string | Event payload. |
Returns#
Promise<void>
Defined in#
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. |
handler | EventCallback<T> | Event handler. |
Returns#
Promise<UnlistenFn>
A promise resolving to a function to unlisten to the event.
Defined in#
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. |
handler | EventCallback<T> | Event handler. |
Returns#
Promise<UnlistenFn>
A promise resolving to a function to unlisten to the event.