1# @ohos.app.appstartup.StartupConfig 2 3The StartupConfig module provides APIs for startup task configuration. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> 9> The APIs of this module can be used only in the stage model. 10 11## Modules to Import 12 13```js 14import { StartupConfig } from '@kit.AbilityKit'; 15``` 16 17## Properties 18 19**System capability**: SystemCapability.Ability.AppStartup 20 21 | Name| Type| Read Only| Optional| Description| 22| -------- | -------- | -------- | -------- | -------- | 23| timeoutMs | number | Yes| Yes| Timeout for executing all startup tasks. The default value is 10000 ms.| 24| startupListener | [StartupListener](./js-apis-app-appstartup-startupListener.md) | Yes| Yes| AppStartup listener, which is called when all the startup tasks are complete.| 25 26**Example** 27 28```ts 29import { StartupConfig, StartupConfigEntry, StartupListener } from '@kit.AbilityKit'; 30import { BusinessError } from '@kit.BasicServicesKit'; 31import { hilog } from '@kit.PerformanceAnalysisKit'; 32 33export default class MyStartupConfigEntry extends StartupConfigEntry { 34 onConfig() { 35 hilog.info(0x0000, 'testTag', `onConfig`); 36 let onCompletedCallback = (error: BusinessError<void>) => { 37 hilog.info(0x0000, 'testTag', `onCompletedCallback`); 38 if (error) { 39 hilog.info(0x0000, 'testTag', 'onCompletedCallback: %{public}d, message: %{public}s', error.code, error.message); 40 } else { 41 hilog.info(0x0000, 'testTag', `onCompletedCallback: success.`); 42 } 43 } 44 let startupListener: StartupListener = { 45 'onCompleted': onCompletedCallback 46 } 47 let config: StartupConfig = { 48 'timeoutMs': 10000, 49 'startupListener': startupListener 50 } 51 return config; 52 } 53} 54``` 55