diff --git a/api/@ohos.app.ability.CompletionHandler.d.ts b/api/@ohos.app.ability.CompletionHandler.d.ts index 835510b07398fb5c4221a785e7714c5b496f411f..ed48691a07aff1c4c3a4644e0ad939ded9dff721 100644 --- a/api/@ohos.app.ability.CompletionHandler.d.ts +++ b/api/@ohos.app.ability.CompletionHandler.d.ts @@ -20,6 +20,31 @@ import { ElementName } from './bundleManager/ElementName'; +/** + * Notify the success result of startAbility. + * + * @typedef { function } + * @param { ElementName } elementName - Indicates the component to start. + * @param { string } message - Indicates the message of the request result. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ +type OnRequestSuccessFn = (elementName: ElementName, message: string) => void; +/** + * Notify the failure result of startAbility. + * + * @typedef { function } + * @param { ElementName } elementName - Indicates the component to start. + * @param { string } message - Indicates the message of the request result. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ +type OnRequestFailureFn = (elementName: ElementName, message: string) => void; + /** * CompletionHandler is a handler to handle the completion events of start ability. * @@ -27,8 +52,9 @@ import { ElementName } from './bundleManager/ElementName'; * @stagemodelonly * @atomicservice * @since 20 + * @arkts 1.1&1.2 */ -export default class CompletionHandler { +declare class CompletionHandler { /** * Notify the success result of startAbility. * @@ -52,4 +78,27 @@ export default class CompletionHandler { * @since 20 */ onRequestFailure(elementName: ElementName, message: string): void; -} \ No newline at end of file + + /** + * Notify the success result of startAbility. + * + * @type { OnRequestSuccessFn } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + onRequestSuccess: OnRequestSuccessFn; + + /** + * Notify the failure result of startAbility. + * + * @type { OnRequestFailureFn } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + onRequestFailure: OnRequestFailureFn; +} +export default CompletionHandler; \ No newline at end of file diff --git a/api/@ohos.app.ability.StartOptions.d.ts b/api/@ohos.app.ability.StartOptions.d.ts index 07b51995b51eff0d532425c16e6f8a39584d3142..f634f021e4dfaa8d1ebafc3d79a7788a3cef041c 100644 --- a/api/@ohos.app.ability.StartOptions.d.ts +++ b/api/@ohos.app.ability.StartOptions.d.ts @@ -20,9 +20,7 @@ import contextConstant from "./@ohos.app.ability.contextConstant"; import image from "./@ohos.multimedia.image"; import bundleManager from './@ohos.bundle.bundleManager'; -/*** if arkts 1.1 */ import CompletionHandler from './@ohos.app.ability.CompletionHandler'; -/*** endif */ /** * StartOptions is the basic communication component of the system. @@ -253,6 +251,7 @@ export default class StartOptions { * @stagemodelonly * @atomicservice * @since 20 + * @arkts 1.1&1.2 */ completionHandler?: CompletionHandler;