From 213a3f0f73ad03fbad9b7418b03445a827a0bd98 Mon Sep 17 00:00:00 2001 From: shiyu_huang Date: Thu, 10 Feb 2022 11:55:33 +0800 Subject: [PATCH] Move definition of LaunchParam form Ability.d.ts to AbilityConstant.d.ts Signed-off-by: shiyu_huang Change-Id: I0fb54a37c9b93ba199eb8feb94e82ffc0f187625 --- api/@ohos.application.Ability.d.ts | 53 +------------- api/@ohos.application.AbilityConstant.d.ts | 81 ++++++++++++++++++++++ 2 files changed, 84 insertions(+), 50 deletions(-) create mode 100644 api/@ohos.application.AbilityConstant.d.ts diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 8978d11534..130fd64dcd 100644 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,7 @@ * limitations under the License. */ +import AbilityConstant from "./@ohos.application.AbilityConstant"; import AbilityContext from "./application/AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; @@ -63,7 +64,7 @@ export default class Ability { * @return - * @StageModelOnly */ - onCreate(want: Want, param: LaunchParam): void; + onCreate(want: Want, param: AbilityConstant.LaunchParam): void; /** * Called back when an ability window stage is created. @@ -131,51 +132,3 @@ export default class Ability { */ onContinue(wantParam : {[key: string]: any}): boolean; } - -export interface LaunchParam { - /** - * Indicates launch reason. - * - * @since 9 - * @sysCap AAFwk - * @StageModelOnly - */ - launchReason: LaunchReason; - - /** - * Indicates last exit reason. - * - * @since 9 - * @sysCap AAFwk - * @StageModelOnly - */ - lastExitReason: LastExitReason; -} - -/** - * Type of launch reason. - * - * @since 9 - * @sysCap AAFwk - * @StageModelOnly - */ -export enum LaunchReason { - UNKNOWN = 0, - START_ABILITY = 1, - CALL = 2, - CONTINUATION = 3, -} - -/** - * Type of last exit reason. - * - * @since 9 - * @sysCap AAFwk - * @StageModelOnly - */ -export enum LastExitReason { - UNKNOWN = 0, - ABILITY_NOT_RESPONDING = 1, - NORMAL = 2, -} - diff --git a/api/@ohos.application.AbilityConstant.d.ts b/api/@ohos.application.AbilityConstant.d.ts new file mode 100644 index 0000000000..0315b14c5d --- /dev/null +++ b/api/@ohos.application.AbilityConstant.d.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * The definition of AbilityConstant. + * + * @since 9 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @StageModelOnly + */ +declare namespace AbilityConstant { + /** + * Interface of launch param. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + export interface LaunchParam { + /** + * Indicates launch reason. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + launchReason: LaunchReason; + + /** + * Indicates last exit reason. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + lastExitReason: LastExitReason; + } + + /** + * Type of launch reason. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + export enum LaunchReason { + UNKNOWN = 0, + START_ABILITY = 1, + CALL = 2, + CONTINUATION = 3, + } + + /** + * Type of last exit reason. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + export enum LastExitReason { + UNKNOWN = 0, + ABILITY_NOT_RESPONDING = 1, + NORMAL = 2, + } +} + +export default AbilityConstant -- Gitee