mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 07:10:52 +00:00
Update d.ts
Signed-off-by: hanhaibin <hanhaibin@huawei.com>
This commit is contained in:
parent
2030a97122
commit
cd6a8d812d
61
api/@ohos.application.abilityDelegatorRegistry.d.ts
vendored
Normal file
61
api/@ohos.application.abilityDelegatorRegistry.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback } from './basic';
|
||||
import { AbilityDelegator } from './application/abilityDelegator'
|
||||
import { AbilityDelegatorArgs } from './application/abilityDelegatorArgs'
|
||||
|
||||
/**
|
||||
* A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered
|
||||
* during application startup.
|
||||
* 在应用程序启动期间,保存AbilityDelegator和AbilityDelegatorArgs对象的全局存储器
|
||||
*
|
||||
* @since 8
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @import import abilityManager from '@ohos.application.abilityManager'
|
||||
* @permission N/A
|
||||
*/
|
||||
declare namespace abilityDelegatorRegistry {
|
||||
/**
|
||||
* Get the AbilityDelegator object of the application.
|
||||
* 异步方式获取应用程序的AbilityDelegator对象
|
||||
* @return the AbilityDelegator object initialized when the application is started.
|
||||
* 应用程序启动时被初始化的AbilityDelegator对象
|
||||
*/
|
||||
function getAbilityDelegator(callback: AsyncCallback<AbilityDelegator>): void;
|
||||
function getAbilityDelegator(): Promise<AbilityDelegator>;
|
||||
|
||||
/**
|
||||
* Get unit test parameters stored in the AbilityDelegatorArgs object.
|
||||
* 异步的方式获取单元测试参数AbilityDelegatorArgs对象
|
||||
* @return the previously registered AbilityDelegatorArgs object.
|
||||
* 单元测试参数AbilityDelegatorArgs对象
|
||||
*/
|
||||
function getArguments(callback: AsyncCallback<AbilityDelegatorArgs>): void;
|
||||
function getArguments(): Promise<AbilityDelegatorArgs>;
|
||||
|
||||
/**
|
||||
* Describes all lifecycle states of an ability.
|
||||
*/
|
||||
export enum AbilityLifecycleState {
|
||||
CREATE,
|
||||
FOREGROUND,
|
||||
BACKGROUND,
|
||||
DESTROY,
|
||||
}
|
||||
}
|
||||
|
||||
export default abilityDelegatorRegistry;
|
41
api/@ohos.application.testRunner.d.ts
vendored
Normal file
41
api/@ohos.application.testRunner.d.ts
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for the test framework.
|
||||
* If you want to implement your own unit test framework, you must inherit this class and overrides all its methods.
|
||||
* 测试框架的执行器基类
|
||||
*
|
||||
* @since 8
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @import import TestRunner from '@ohos.application.testRunner'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface TestRunner {
|
||||
/**
|
||||
* Prepare the unit testing environment for running test cases.
|
||||
* 为执行器准备单元测试环境
|
||||
*/
|
||||
onPrepare(): void;
|
||||
|
||||
/**
|
||||
* Run all test cases.
|
||||
* 运行所有的测试用例
|
||||
*/
|
||||
onRun(): void;
|
||||
}
|
||||
|
||||
export default TestRunner;
|
122
api/application/abilityDelegator.d.ts
vendored
Normal file
122
api/application/abilityDelegator.d.ts
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback } from '../basic';
|
||||
import { Ability } from '../@ohos.application.Ability'
|
||||
import { AbilityMonitor } from './abilityMonitor'
|
||||
import { Context } from '../app/context'
|
||||
import { ShellCmdResult } from './shellCmdResult'
|
||||
|
||||
/**
|
||||
* A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities.
|
||||
*
|
||||
* @since 8
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @import import AbilityDelegator from 'application/abilityDelegator.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface AbilityDelegator {
|
||||
/**
|
||||
* Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability.
|
||||
* 添加AbilityMonitor实例,用于监听ability生命周期变换
|
||||
* @param monitor AbilityMonitor实例
|
||||
*/
|
||||
addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<void>): void;
|
||||
addAbilityMonitor(monitor: AbilityMonitor): Promise<void>;
|
||||
|
||||
/**
|
||||
* Remove a specified AbilityMonitor object from the application memory.
|
||||
* 删除已经添加的AbilityMonitor实例
|
||||
* @param monitor AbilityMonitor实例
|
||||
*/
|
||||
removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<void>): void;
|
||||
removeAbilityMonitor(monitor: AbilityMonitor): Promise<void>;
|
||||
|
||||
/**
|
||||
* Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor.
|
||||
* 等待与AbilityMonitor实例匹配的ability到达OnCreate生命周期,并返回ability实例
|
||||
* @param monitor AbilityMonitor实例
|
||||
* @param timeout 最大等待时间,单位毫秒
|
||||
* @return 如果监听到与指定AbilityMonitor实例匹配的Abilityability到达OnCreate生命周期,则返回ability实例;否则返回空
|
||||
*/
|
||||
waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<Ability>): void;
|
||||
waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback<Ability>): void;
|
||||
waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise<Ability>;
|
||||
|
||||
/**
|
||||
* Obtain the application context.
|
||||
* 异步方式获取应用Context,通过异步回调将Context实例返回
|
||||
* @return 应用Context
|
||||
*/
|
||||
getAppContext(callback: AsyncCallback<Context>): void;
|
||||
getAppContext(): Promise<Context>;
|
||||
|
||||
/**
|
||||
* Obtain the lifecycle state of a specified ability.
|
||||
* 异步方式获取指定ability状态
|
||||
* @param ability 指定Ability对象
|
||||
* @return 指定Ability对象的状态
|
||||
*/
|
||||
getAbilityState(ability: Ability, callback: AsyncCallback<number>): void;
|
||||
getAbilityState(ability: Ability): Promise<number>;
|
||||
|
||||
/**
|
||||
* Obtain the ability that is currently being displayed.
|
||||
* 异步方式获取当前应用顶部ability
|
||||
* @return 当前应用顶部ability
|
||||
*/
|
||||
getCurrentTopAbility(callback: AsyncCallback<Ability>): void;
|
||||
getCurrentTopAbility(): Promise<Ability>
|
||||
|
||||
/**
|
||||
* Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state.
|
||||
* 异步方式调度指定ability生命周期状态到Foreground状态
|
||||
* @param ability 指定Ability对象
|
||||
* @return true: 成功 false: 失败
|
||||
*/
|
||||
doAbilityForeground(ability: Ability, callback: AsyncCallback<boolean>): void;
|
||||
doAbilityForeground(ability: Ability): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state.
|
||||
* 异步方式调度指定ability生命周期状态到Background状态
|
||||
* @param ability 指定Ability对象
|
||||
* @return true: 成功 false: 失败
|
||||
*/
|
||||
doAbilityBackground(ability: Ability, callback: AsyncCallback<boolean>): void;
|
||||
doAbilityBackground(ability: Ability): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Prints log information to the unit testing console.
|
||||
* The total length of the log information to be printed cannot exceed 1000 characters.
|
||||
* 异步方式打印日志信息到单元测试终端控制台
|
||||
* 日志信息字符串长度最大不超过1000个字符
|
||||
* @param msg 日志字符串
|
||||
*/
|
||||
print(msg: string, callback: AsyncCallback<void>): void;
|
||||
print(msg: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Execute the given command in the aa tools side.
|
||||
* 异步方式执行指定的shell命令
|
||||
* @param cmd shell命令字符串
|
||||
* @return shell命令执行结果对象
|
||||
*/
|
||||
executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback<ShellCmdResult>): void;
|
||||
executeShellCommand(cmd: string, timeoutSecs: number): Promise<ShellCmdResult>;
|
||||
}
|
||||
|
||||
export default AbilityDelegator;
|
53
api/application/abilityDelegatorArgs.d.ts
vendored
Normal file
53
api/application/abilityDelegatorArgs.d.ts
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Store unit testing-related parameters, including test case names, and test runner name.
|
||||
* 存储单元测试相关的参数,包括测试用例名称,测试用例执行器名称
|
||||
*
|
||||
* @since 8
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @import import AbilityDelegatorArgs from 'application/abilityDelegatorArgs.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface AbilityDelegatorArgs {
|
||||
/**
|
||||
* the bundle name of the application being tested.
|
||||
* 表示当前被测试应用的包名
|
||||
*/
|
||||
bundleName: string;
|
||||
|
||||
/**
|
||||
* the parameters used for unit testing.
|
||||
* 表示当前启动单元测试的参数
|
||||
*/
|
||||
parameters: {[key: string]: string};
|
||||
|
||||
/**
|
||||
* the class names of all test cases.
|
||||
* 测试用例名称
|
||||
*/
|
||||
testCaseNames: string;
|
||||
|
||||
/**
|
||||
* the class name of the test runner used to execute test cases.
|
||||
* 执行测试用例的测试执行器的名称
|
||||
*/
|
||||
testRunnerClassName: string;
|
||||
}
|
||||
|
||||
export default AbilityDelegatorArgs;
|
77
api/application/abilityMonitor.d.ts
vendored
Normal file
77
api/application/abilityMonitor.d.ts
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provide methods for matching monitored Ability objects that meet specified conditions.
|
||||
* The most recently matched Ability objects will be saved in the AbilityMonitor object.
|
||||
* 监听指定Ability生命周期状态变化的监听器
|
||||
*
|
||||
* @since 8
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @import import AbilityMonitor from 'application/abilityMonitor.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface AbilityMonitor {
|
||||
/**
|
||||
* The name of the ability to monitor.
|
||||
* 表示当前AbilityMonitor绑定的ability name
|
||||
*/
|
||||
abilityName: string;
|
||||
|
||||
/**
|
||||
* Called back when the ability is started for initialization.
|
||||
* ability被启动初始化时的回调函数
|
||||
*/
|
||||
onAbilityCreate?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when the state of the ability changes to foreground.
|
||||
* ability状态变成前台时的回调函数
|
||||
*/
|
||||
onAbilityForeground?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when the state of the ability changes to background.
|
||||
* ability状态变成后台时的回调函数
|
||||
*/
|
||||
onAbilityBackground?:() => void;
|
||||
|
||||
/**
|
||||
* Called back before the ability is destroyed.
|
||||
* ability被销毁前的回调函数
|
||||
*/
|
||||
onAbilityDestroy?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when an ability window stage is created.
|
||||
* window stage被创建时的回调函数
|
||||
*/
|
||||
onWindowStageCreate?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when an ability window stage is restored.
|
||||
* window stage被重载时的回调函数
|
||||
*/
|
||||
onWindowStageRestore?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when an ability window stage is destroyed.
|
||||
* window stage被销毁前的回调函数
|
||||
*/
|
||||
onWindowStageDestroy?:() => void;
|
||||
}
|
||||
|
||||
export default AbilityMonitor;
|
40
api/application/shellCmdResult.d.ts
vendored
Normal file
40
api/application/shellCmdResult.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A object that records the result of shell command executes.
|
||||
* 执行shell命令的结果
|
||||
*
|
||||
* @since 8
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @import import ShellCmdResult from 'application/shellCmdResult.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface ShellCmdResult {
|
||||
/**
|
||||
* the cmd standard result.
|
||||
* shell命令标准输出结果
|
||||
*/
|
||||
stdResult: String;
|
||||
|
||||
/**
|
||||
* shell cmd exec result.
|
||||
* shell命令执行的结果
|
||||
*/
|
||||
exitCode: number;
|
||||
}
|
||||
|
||||
export default ShellCmdResult;
|
Loading…
Reference in New Issue
Block a user