• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.ability.StartOptions (StartOptions)
2
3**StartOptions** is used as an input parameter of [startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1) to specify the window mode of an ability.
4
5> **NOTE**
6>
7> 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.
8> The APIs of this module can be used only in the stage model.
9
10## Modules to Import
11
12```ts
13import StartOptions from '@ohos.app.ability.StartOptions';
14```
15
16## Attributes
17
18
19**System capability**: SystemCapability.Ability.AbilityRuntime.Core
20
21**System API**: This is a system API and cannot be called by third-party applications.
22
23| Name| Type| Mandatory| Description|
24| -------- | -------- | -------- | -------- |
25| [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.|
26| displayId | number | No| Display ID.|
27
28**Example**
29
30  ```ts
31  import missionManager from '@ohos.app.ability.missionManager';
32
33  try {
34    missionManager.getMissionInfos('', 10, (error, missions) => {
35      if (error.code) {
36          console.log('getMissionInfos failed, error.code:' + JSON.stringify(error.code) +
37            'error.message:' + JSON.stringify(error.message));
38          return;
39      }
40      console.log('size = ' + missions.length);
41      console.log('missions = ' + JSON.stringify(missions));
42      let id = missions[0].missionId;
43
44      let startOptions = {
45          windowMode : 101,
46          displayId: 0
47      };
48      missionManager.moveMissionToFront(id, startOptions).then(() => {
49  	    console.log('moveMissionToFront is called ');
50      });
51    });
52  } catch (paramError) {
53    console.log('error: ' + paramError.code + ', ' + paramError.message);
54  }
55  ```
56