1# @ohos.app.appstartup.StartupConfigEntry
2
3
4The StartupConfigEntry module provides the API for configuring AppStartup.
5
6> **NOTE**
7>
8> 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.
9>
10> The APIs of this module can be used only in the stage model.
11
12## Modules to Import
13
14```ts
15import { StartupConfigEntry } from '@kit.AbilityKit';
16```
17
18## StartupConfigEntry.onConfig
19
20onConfig?(): StartupConfig
21
22Called during application startup to configure AppStartup.
23
24**System capability**: SystemCapability.Ability.AppStartup
25
26**Return value**
27
28| Type | Description |
29| -------- | -------- |
30| StartupConfig | AppStartup configuration. |
31
32**Example**
33
34```ts
35import { StartupConfig, StartupConfigEntry, StartupListener } from '@kit.AbilityKit';
36import { BusinessError } from '@kit.BasicServicesKit';
37import { hilog } from '@kit.PerformanceAnalysisKit';
38
39export default class MyStartupConfigEntry extends StartupConfigEntry {
40  onConfig() {
41    hilog.info(0x0000, 'testTag', `onConfig`);
42    let onCompletedCallback = (error: BusinessError<void>) => {
43      hilog.info(0x0000, 'testTag', `onCompletedCallback`);
44      if (error) {
45        hilog.info(0x0000, 'testTag', 'onCompletedCallback: %{public}d, message: %{public}s', error.code, error.message);
46      } else {
47        hilog.info(0x0000, 'testTag', `onCompletedCallback: success.`);
48      }
49    }
50    let startupListener: StartupListener = {
51      'onCompleted': onCompletedCallback
52    }
53    let config: StartupConfig = {
54      'timeoutMs': 10000,
55      'startupListener': startupListener
56    }
57    return config;
58  }
59}
60```
61