js-apis-abilityDelegatorRegistry.md 3.0 KB
Newer Older
N
njupthan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# AbilityDelegatorRegistry

> **说明**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

## 导入模块

```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```



## AbilityLifecycleState

Ability生命周期状态

| 名称          | 值   | 说明                                                         |
| ------------- | ---- | ------------------------------------------------------------ |
N
njupthan 已提交
21 22 23 24 25
| UNINITIALIZED | 0    | 表示无效状态。<br/>**系统能力** :SystemCapability.Ability.AbilityRuntime.Core |
| CREATE        | 1    | 表示Ability处于已创建状态。<br/>**系统能力** :SystemCapability.Ability.AbilityRuntime.Core |
| FOREGROUND    | 2    | 表示Ability处于前台状态。<br/>**系统能力** :SystemCapability.Ability.AbilityRuntime.Core |
| BACKGROUND    | 3    | 表示Ability处于后台状态。<br/>**系统能力** :SystemCapability.Ability.AbilityRuntime.Core |
| DESTROY       | 4    | 表示Ability处于已销毁状态。<br/>**系统能力** :SystemCapability.Ability.AbilityRuntime.Core |
N
njupthan 已提交
26 27 28 29 30 31 32 33 34



## AbilityDelegatorRegistry.getAbilityDelegator

getAbilityDelegator(): AbilityDelegator

获取应用程序的AbilityDelegator对象

N
njupthan 已提交
35
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core
N
njupthan 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

**返回值:**

| 类型                                                         | 说明                                                         |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator)对象。可有用来调度测试框架相关功能。 |

**示例:**

```js
var abilityDelegator;

abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
```



## AbilityDelegatorRegistry.getArguments

getArguments(): AbilityDelegatorArgs

获取单元测试参数AbilityDelegatorArgs对象

N
njupthan 已提交
59
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core
N
njupthan 已提交
60 61 62 63 64 65 66 67 68 69 70

**返回值:**

| 类型                                                         | 说明                                                         |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs)对象。可以用来获取测试参数。 |

**示例:**

```js
var args = AbilityDelegatorRegistry.getArguments();
N
njupthan 已提交
71 72 73
console.info("getArguments bundleName:" + args.bundleName);
console.info("getArguments testCaseNames:" + args.testCaseNames);
console.info("getArguments testRunnerClassName:" + args.testRunnerClassName);
N
njupthan 已提交
74
```