• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Stopping a PageAbility
2
3
4The **terminateSelf()** method in the **featureAbility** class is used to stop a PageAbility.
5
6**Table 1** featureAbility APIs
7
8| API| Description|
9| -------- | -------- |
10| terminateSelf() | Terminates this ability.|
11| terminateSelfWithResult(parameter: AbilityResult) | Terminates this ability and returns the execution result.|
12
13
14The following code snippet shows how to stop an ability.
15
16```ts
17import featureAbility from '@ohos.ability.featureAbility'
18
19(async () => {
20  try {
21    console.info('Begin to terminateSelf')
22    await featureAbility.terminateSelf()
23    console.info('terminateSelf succeed')
24  }
25  catch (error) {
26    console.error('terminateSelf failed with ' + error)
27  }
28})()
29```
30