• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License"),
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import UIAbility from "./@ohos.app.ability.UIAbility";
17import dataAbility from "./@ohos.data.dataAbility";
18import window from './@ohos.window';
19
20/**
21 * The ability lifecycle callback.
22 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
23 * @StageModelOnly
24 * @since 9
25 */
26export default class AbilityLifecycleCallback {
27    /**
28     * Called back when an ability is started for initialization.
29     * @param { Ability } ability - Indicates the ability to register for listening.
30     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
31     * @StageModelOnly
32     * @since 9
33     */
34    onAbilityCreate(ability: UIAbility): void;
35
36    /**
37     * Called back when a window stage is created.
38     * @param { Ability } ability - Indicates the ability to register for listening.
39     * @param { window.WindowStage } windowStage - window stage to create
40     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
41     * @StageModelOnly
42     * @since 9
43     */
44    onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void;
45
46    /**
47     * Called back when a window stage is actived.
48     * @param { Ability } ability - Indicates the ability to register for listening.
49     * @param { window.WindowStage } windowStage - window stage to active
50     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
51     * @StageModelOnly
52     * @since 9
53     */
54    onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void;
55
56    /**
57     * Called back when a window stage is inactived.
58     * @param { Ability } ability - Indicates the ability to register for listening.
59     * @param { window.WindowStage } windowStage - window stage to inactive
60     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
61     * @StageModelOnly
62     * @since 9
63     */
64    onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void;
65
66    /**
67     * Called back when a window stage is destroyed.
68     * @param { Ability } ability - Indicates the ability to register for listening.
69     * @param { window.WindowStage } windowStage - window stage to destroy
70     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
71     * @StageModelOnly
72     * @since 9
73     */
74    onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void;
75
76    /**
77     * Called back when an ability is destroyed.
78     * @param { Ability } ability - Indicates the ability to register for listening.
79     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
80     * @StageModelOnly
81     * @since 9
82     */
83    onAbilityDestroy(ability: UIAbility): void;
84
85    /**
86     * Called back when the state of an ability changes to foreground.
87     * @param { Ability } ability - Indicates the ability to register for listening.
88     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
89     * @StageModelOnly
90     * @since 9
91     */
92    onAbilityForeground(ability: UIAbility): void;
93
94    /**
95     * Called back when the state of an ability changes to background.
96     * @param { Ability } ability - Indicates the ability to register for listening.
97     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
98     * @StageModelOnly
99     * @since 9
100     */
101    onAbilityBackground(ability: UIAbility): void;
102
103    /**
104     * Called back when an ability prepares to continue.
105     * @param { Ability } ability - Indicates the ability to register for listening.
106     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
107     * @StageModelOnly
108     * @since 9
109     */
110    onAbilityContinue(ability: UIAbility): void;
111}