1/* 2 * Copyright (c) 2022-2023 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 * 23 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 24 * @StageModelOnly 25 * @since 9 26 */ 27/** 28 * The ability lifecycle callback. 29 * 30 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 31 * @StageModelOnly 32 * @crossplatform 33 * @since 10 34 */ 35export default class AbilityLifecycleCallback { 36 /** 37 * Called back when an ability is started for initialization. 38 * 39 * @param { UIAbility } ability - Indicates the ability to register for listening. 40 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 41 * @StageModelOnly 42 * @since 9 43 */ 44 /** 45 * Called back when an ability is started for initialization. 46 * 47 * @param { UIAbility } ability - Indicates the ability to register for listening. 48 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 49 * @StageModelOnly 50 * @crossplatform 51 * @since 10 52 */ 53 onAbilityCreate(ability: UIAbility): void; 54 55 /** 56 * Called back when a window stage is created. 57 * 58 * @param { UIAbility } ability - Indicates the ability to register for listening. 59 * @param { window.WindowStage } windowStage - window stage to create 60 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 61 * @StageModelOnly 62 * @since 9 63 */ 64 /** 65 * Called back when a window stage is created. 66 * 67 * @param { UIAbility } ability - Indicates the ability to register for listening. 68 * @param { window.WindowStage } windowStage - window stage to create 69 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 70 * @StageModelOnly 71 * @crossplatform 72 * @since 10 73 */ 74 onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void; 75 76 /** 77 * Called back when a window stage is active. 78 * 79 * @param { UIAbility } ability - Indicates the ability to register for listening. 80 * @param { window.WindowStage } windowStage - window stage to active 81 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 82 * @StageModelOnly 83 * @since 9 84 */ 85 onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void; 86 87 /** 88 * Called back when a window stage is inactive. 89 * 90 * @param { UIAbility } ability - Indicates the ability to register for listening. 91 * @param { window.WindowStage } windowStage - window stage to inactive 92 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 93 * @StageModelOnly 94 * @since 9 95 */ 96 onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void; 97 98 /** 99 * Called back when a window stage is destroyed. 100 * 101 * @param { UIAbility } ability - Indicates the ability to register for listening. 102 * @param { window.WindowStage } windowStage - window stage to destroy 103 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 104 * @StageModelOnly 105 * @since 9 106 */ 107 /** 108 * Called back when a window stage is destroyed. 109 * 110 * @param { UIAbility } ability - Indicates the ability to register for listening. 111 * @param { window.WindowStage } windowStage - window stage to destroy 112 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 113 * @StageModelOnly 114 * @crossplatform 115 * @since 10 116 */ 117 onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void; 118 119 /** 120 * Called back when an ability is destroyed. 121 * 122 * @param { UIAbility } ability - Indicates the ability to register for listening. 123 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 124 * @StageModelOnly 125 * @since 9 126 */ 127 /** 128 * Called back when an ability is destroyed. 129 * 130 * @param { UIAbility } ability - Indicates the ability to register for listening. 131 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 132 * @StageModelOnly 133 * @crossplatform 134 * @since 10 135 */ 136 onAbilityDestroy(ability: UIAbility): void; 137 138 /** 139 * Called back when the state of an ability changes to foreground. 140 * 141 * @param { UIAbility } ability - Indicates the ability to register for listening. 142 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 143 * @StageModelOnly 144 * @since 9 145 */ 146 /** 147 * Called back when the state of an ability changes to foreground. 148 * 149 * @param { UIAbility } ability - Indicates the ability to register for listening. 150 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 151 * @StageModelOnly 152 * @crossplatform 153 * @since 10 154 */ 155 onAbilityForeground(ability: UIAbility): void; 156 157 /** 158 * Called back when the state of an ability changes to background. 159 * 160 * @param { UIAbility } ability - Indicates the ability to register for listening. 161 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 162 * @StageModelOnly 163 * @since 9 164 */ 165 /** 166 * Called back when the state of an ability changes to background. 167 * 168 * @param { UIAbility } ability - Indicates the ability to register for listening. 169 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 170 * @StageModelOnly 171 * @crossplatform 172 * @since 10 173 */ 174 onAbilityBackground(ability: UIAbility): void; 175 176 /** 177 * Called back when an ability prepares to continue. 178 * 179 * @param { UIAbility } ability - Indicates the ability to register for listening. 180 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 181 * @StageModelOnly 182 * @since 9 183 */ 184 onAbilityContinue(ability: UIAbility): void; 185} 186