Class (JsResult)

Implements the JsResult object to confirm or cancel a dialog box. For details about the sample code, see onAlert.

NOTE

  • 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

constructor()

Constructs a JsResult object.

System capability: SystemCapability.Web.Webview.Core

handleCancel

handleCancel(): void

Notifies the Web component of the user's cancel operation in the dialog box.

System capability: SystemCapability.Web.Webview.Core

handleConfirm

handleConfirm(): void

Notifies the Web component of the user's confirm operation in the dialog box.

System capability: SystemCapability.Web.Webview.Core

handlePromptConfirm9+

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.