• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AbilityMonitor
2
3> **NOTE**
4>
5> 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.
6
7## Modules to Import
8
9```js
10import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
11```
12
13
14
15## AbilityMonitor
16
17Describes an ability monitor.
18
19| Name                                                        | Type    | Readable| Writable| Description                                                        |
20| ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ |
21| abilityName                                                  | string   | Yes  | Yes  | Name of the ability bound to the ability monitor.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
22| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the ability is created.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
23| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the ability starts to run in the foreground.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
24| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the ability starts to run in the background.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
25| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the ability is destroyed.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
26| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the window stage is created.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
27| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the window stage is restored.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
28| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes  | Yes  | Called when the window stage is destroyed.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
29