Implements the JsResult object to confirm or cancel a dialog box. For details about the sample code, see onAlert.
The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The initial APIs of this class are supported since API version 8.
The sample effect is subject to the actual device.
constructor()
Constructs a JsResult object.
System capability: SystemCapability.Web.Webview.Core
handleCancel(): void
Notifies the Web component of the user's cancel operation in the dialog box.
System capability: SystemCapability.Web.Webview.Core
handleConfirm(): void
Notifies the Web component of the user's confirm operation in the dialog box.
System capability: SystemCapability.Web.Webview.Core
handlePromptConfirm(result: string): void
Notifies the Web component of the user's confirm operation in the dialog box as well as the dialog box content.
System capability: SystemCapability.Web.Webview.Core
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| result | string | Yes | User input in the dialog box. |