• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AbilityResult
2
3The **AbilityResult** module defines the result code and data returned when an ability is terminated after being started.
4
5In the stage model, you can use [startAbilityForResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilityforresult) to obtain the **AbilityResult** object returned after the started ability is terminated by calling [terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult).
6
7In the FA model, you can use [startAbilityForResult](js-apis-ability-featureAbility.md#featureabilitystartabilityforresult7) to obtain the **AbilityResult** object returned after the started ability is terminated by calling [terminateSelfWithResult](js-apis-ability-featureAbility.md#featureabilityterminateselfwithresult7).
8
9> **NOTE**
10>
11> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
12
13## Modules to Import
14
15Stage model:
16```ts
17import common from '@ohos.app.ability.common';
18```
19
20FA model:
21```ts
22import ability from '@ohos.ability.ability';
23```
24
25## Attributes
26
27**System capability**: SystemCapability.Ability.AbilityBase
28
29| Name       |  Type                | Read-only| Mandatory| Description                                                        |
30| ----------- | -------------------- | ---- | ---- | ------------------------------------------------------------ |
31| resultCode  | number               | No  | Yes  | Result code returned after the started ability is terminated.                               |
32| want  | [Want](js-apis-app-ability-want.md)               | No  | No  | Data returned after the started ability is terminated.|
33