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**System capability**: SystemCapability.Ability.AbilityRuntime.Core 19 20| Name| Type| Mandatory| Description| 21| -------- | -------- | -------- | -------- | 22| [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.<br>**System API**: This is a system API and cannot be called by third-party applications.| 23| displayId | number | No| Display ID mode. The default value is **0**, indicating the current display.| 24| withAnimation<sup>11+</sup> | boolean | No| Whether the ability has the animation effect.| 25| windowLeft<sup>11+</sup> | number | No| Left position of the window.| 26| windowTop<sup>11+</sup> | number | No| Top position of the window.| 27| windowWidth<sup>11+</sup> | number | No| Width of the window.| 28| windowHeight<sup>11+</sup> | number | No| Height of the window.| 29 30**Example** 31 32 ```ts 33 import UIAbility from '@ohos.app.ability.UIAbility'; 34 import Want from '@ohos.app.ability.Want'; 35 import StartOptions from '@ohos.app.ability.StartOptions'; 36 import { BusinessError } from '@ohos.base'; 37 38 export default class EntryAbility extends UIAbility { 39 40 onForeground() { 41 let want: Want = { 42 deviceId: '', 43 bundleName: 'com.example.myapplication', 44 abilityName: 'EntryAbility' 45 }; 46 let options: StartOptions = { 47 windowMode: 0 48 }; 49 50 try { 51 this.context.startAbility(want, options, (err: BusinessError) => { 52 if (err.code) { 53 // Process service logic errors. 54 console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); 55 return; 56 } 57 // Carry out normal service processing. 58 console.info('startAbility succeed'); 59 }); 60 } catch (err) { 61 // Process input parameter errors. 62 let code = (err as BusinessError).code; 63 let message = (err as BusinessError).message; 64 console.error(`startAbility failed, code is ${code}, message is ${message}`); 65 } 66 } 67 } 68 ``` 69