promptAction,UIcontext 添加 openToast,closeToast接口

Signed-off-by: yangziyong <nsyangziyong@huawei.com>
This commit is contained in:
yangziyong 2024-06-18 09:01:52 +08:00
parent 40ac165759
commit 31f3c1186c
2 changed files with 66 additions and 0 deletions

View File

@ -965,6 +965,39 @@ export class PromptAction {
*/ */
showToast(options: promptAction.ShowToastOptions): void; showToast(options: promptAction.ShowToastOptions): void;
/**
* Displays the notification text.
*
* @param { promptAction.ShowToastOptions } options - Options.
* @returns { Promise<number> } return the toast id that will be used by closeToast.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br> 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameters types.
* <br> 3. Parameter verification failed.
* @throws { BusinessError } 100001 - Internal error.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
openToast(options: promptAction.ShowToastOptions): Promise<number>;
/**
* Close the notification text.
*
* @param { number } toastId - the toast id that returned by openToast.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br> 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameters types.
* <br> 3. Parameter verification failed.
* @throws { BusinessError } 100001 - Internal error.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
closeToast(toastId: number): void;
/** /**
* Displays the dialog box. * Displays the dialog box.
* *

View File

@ -1115,6 +1115,39 @@ declare namespace promptAction {
*/ */
function showToast(options: ShowToastOptions): void; function showToast(options: ShowToastOptions): void;
/**
* Displays the notification text.
*
* @param { ShowToastOptions } options - Options.
* @returns { Promise<number> } return the toast id that will be used by closeToast.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br> 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameters types.
* <br> 3. Parameter verification failed.
* @throws { BusinessError } 100001 - Internal error.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
function openToast(options: ShowToastOptions): Promise<number>;
/**
* Close the notification text.
*
* @param { number } toastId - the toast id that returned by openToast.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br> 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameters types.
* <br> 3. Parameter verification failed.
* @throws { BusinessError } 100001 - Internal error.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
function closeToast(toastId: number): void;
/** /**
* Displays the dialog box. * Displays the dialog box.
* *