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