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
-
WebviewWindowHandle
Constructors
constructor
• new WebviewWindowHandle(label)
Parameters
| Name | Type |
|---|---|
label |
string |
Defined in
Properties
label
• label: string
The window label. It is a unique identifier for the window, can be used to reference it later.
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. Must include only alphanumeric characters, -, /, : and _. |
payload? |
unknown |
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. 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
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.