@@ -9,13 +9,16 @@ This module provides the following common ability-related functions:
...
@@ -9,13 +9,16 @@ This module provides the following common ability-related functions:
> **NOTE**
> **NOTE**
>
>
> The APIs of this module are deprecated since API version 9. You are advised to use [@ohos.app.ability.UIAbility (UIAbility)](js-apis-app-ability-uiAbility.md) instead.
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs of this module can be used only in the stage model.
> The APIs of this module can be used only in the stage model.
## Modules to Import
## Modules to Import
```ts
```ts
importUIAbilityfrom'@ohos.app.ability.UIAbility';
importUIAbilityfrom'@ohos.application.Ability';
```
```
## Attributes
## Attributes
...
@@ -72,7 +75,7 @@ Called when a **WindowStage** is created for this ability.
...
@@ -72,7 +75,7 @@ Called when a **WindowStage** is created for this ability.
**Example**
**Example**
```ts
```ts
classmyAbilityextendsAbility{
exportdefaultclassEntryAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
}
}
...
@@ -91,7 +94,7 @@ Called when the **WindowStage** is destroyed for this ability.
...
@@ -91,7 +94,7 @@ Called when the **WindowStage** is destroyed for this ability.
**Example**
**Example**
```ts
```ts
classmyAbilityextendsAbility{
exportdefaultclassEntryAbilityextendsUIAbility{
onWindowStageDestroy(){
onWindowStageDestroy(){
console.log('onWindowStageDestroy');
console.log('onWindowStageDestroy');
}
}
...
@@ -116,7 +119,7 @@ Called when the **WindowStage** is restored during the migration of this ability
...
@@ -116,7 +119,7 @@ Called when the **WindowStage** is restored during the migration of this ability
**Example**
**Example**
```ts
```ts
classmyAbilityextendsAbility{
exportdefaultclassEntryAbilityextendsUIAbility{
onWindowStageRestore(windowStage){
onWindowStageRestore(windowStage){
console.log('onWindowStageRestore');
console.log('onWindowStageRestore');
}
}
...
@@ -135,7 +138,7 @@ Called when this ability is destroyed to clear resources.
...
@@ -135,7 +138,7 @@ Called when this ability is destroyed to clear resources.
**Example**
**Example**
```ts
```ts
classmyAbilityextendsAbility{
exportdefaultclassEntryAbilityextendsUIAbility{
onDestroy(){
onDestroy(){
console.log('onDestroy');
console.log('onDestroy');
}
}
...
@@ -154,7 +157,7 @@ Called when this ability is switched from the background to the foreground.
...
@@ -154,7 +157,7 @@ Called when this ability is switched from the background to the foreground.
**Example**
**Example**
```ts
```ts
classmyAbilityextendsAbility{
exportdefaultclassEntryAbilityextendsUIAbility{
onForeground(){
onForeground(){
console.log('onForeground');
console.log('onForeground');
}
}
...
@@ -173,7 +176,7 @@ Called when this ability is switched from the foreground to the background.
...
@@ -173,7 +176,7 @@ Called when this ability is switched from the foreground to the background.
**Example**
**Example**
```ts
```ts
classmyAbilityextendsAbility{
exportdefaultclassEntryAbilityextendsUIAbility{
onBackground(){
onBackground(){
console.log('onBackground');
console.log('onBackground');
}
}
...
@@ -204,8 +207,9 @@ Called to save data during the ability migration preparation process.
...
@@ -204,8 +207,9 @@ Called to save data during the ability migration preparation process.
@@ -10,7 +10,7 @@ The **AbilityDelegator** module provides APIs for managing **AbilityMonitor** in
...
@@ -10,7 +10,7 @@ The **AbilityDelegator** module provides APIs for managing **AbilityMonitor** in
An **AbilityDelegator** object is obtained by calling [getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator) in **AbilityDelegatorRegistry**.
An **AbilityDelegator** object is obtained by calling [getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator) in **AbilityDelegatorRegistry**.