1# AbilityStage 2 3>  **NOTE** 4> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 5 6 7Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads. 8 9 10## Modules to Import 11 12 13```js 14import AbilityStage from '@ohos.application.AbilityStage'; 15``` 16 17## AbilityStage.onCreate 18 19onCreate(): void 20 21Called when the application is created. 22 23**System capability**: SystemCapability.Ability.AbilityRuntime.Core 24 25 26 27**Example** 28 29 ```js 30 class MyAbilityStage extends AbilityStage { 31 onCreate() { 32 console.log("MyAbilityStage.onCreate is called") 33 } 34 } 35 ``` 36 37 38## AbilityStage.onAcceptWant 39 40onAcceptWant(want: Want): string; 41 42Called when a specified ability is started. 43 44**System capability**: SystemCapability.Ability.AbilityRuntime.Core 45 46**Parameters** 47 48 | Name| Type| Mandatory| Description| 49 | -------- | -------- | -------- | -------- | 50 | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.| 51 52**Return value** 53 54 | Type| Description| 55 | -------- | -------- | 56 | string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started.| 57 58**Example** 59 60 ```js 61 class MyAbilityStage extends AbilityStage { 62 onAcceptWant(want) { 63 console.log("MyAbilityStage.onAcceptWant called"); 64 return "com.example.test"; 65 } 66 } 67 ``` 68 69 70## AbilityStage.onConfigurationUpdated 71 72onConfigurationUpdated(config: Configuration): void; 73 74Called when the global configuration is updated. 75 76**System capability**: SystemCapability.Ability.AbilityRuntime.Core 77 78**Parameters** 79 80 | Name| Type| Mandatory| Description| 81 | -------- | -------- | -------- | -------- | 82 | config | [Configuration](js-apis-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.| 83 84**Example** 85 86 ```js 87 class MyAbilityStage extends AbilityStage { 88 onConfigurationUpdated(config) { 89 console.log('onConfigurationUpdated, language:' + config.language); 90 } 91 } 92 ``` 93## AbilityStage.context 94 95Describes the configuration information about the context. 96 97**System capability**: SystemCapability.Ability.AbilityRuntime.Core 98 99| Name | Type | Description | 100| ----------- | --------------------------- | ------------------------------------------------------------ | 101| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup.| 102