mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-12-14 11:09:00 +00:00
Update d.ts
Signed-off-by: njupthan <hanhaibin@huawei.com>
This commit is contained in:
parent
6109d29b20
commit
9713dba674
@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback } from './basic';
|
||||
import { AbilityDelegator } from './application/abilityDelegator'
|
||||
import { AbilityDelegatorArgs } from './application/abilityDelegatorArgs'
|
||||
|
||||
@ -22,26 +21,34 @@ import { AbilityDelegatorArgs } from './application/abilityDelegatorArgs'
|
||||
* during application startup.
|
||||
*
|
||||
* @since 9
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @import import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
|
||||
* @permission N/A
|
||||
*/
|
||||
declare namespace abilityDelegatorRegistry {
|
||||
/**
|
||||
* Get the AbilityDelegator object of the application.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @return the AbilityDelegator object initialized when the application is started.
|
||||
*/
|
||||
function getAbilityDelegator(): AbilityDelegator;
|
||||
|
||||
/**
|
||||
* Get unit test parameters stored in the AbilityDelegatorArgs object.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @return the previously registered AbilityDelegatorArgs object.
|
||||
*/
|
||||
function getArguments(): AbilityDelegatorArgs;
|
||||
|
||||
/**
|
||||
* Describes all lifecycle states of an ability.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
export enum AbilityLifecycleState {
|
||||
UNINITIALIZED,
|
||||
|
9
api/@ohos.application.testRunner.d.ts
vendored
9
api/@ohos.application.testRunner.d.ts
vendored
@ -18,19 +18,24 @@
|
||||
* If you want to implement your own unit test framework, you must inherit this class and overrides all its methods.
|
||||
*
|
||||
* @since 9
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @import import TestRunner from '@ohos.application.testRunner'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface TestRunner {
|
||||
/**
|
||||
* Prepare the unit testing environment for running test cases.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onPrepare(): void;
|
||||
|
||||
/**
|
||||
* Run all test cases.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onRun(): void;
|
||||
}
|
||||
|
40
api/application/abilityDelegator.d.ts
vendored
40
api/application/abilityDelegator.d.ts
vendored
@ -23,14 +23,16 @@ import { ShellCmdResult } from './shellCmdResult'
|
||||
* A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities.
|
||||
*
|
||||
* @since 9
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @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.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param monitor AbilityMonitor object
|
||||
*/
|
||||
addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<void>): void;
|
||||
@ -38,6 +40,9 @@ export interface AbilityDelegator {
|
||||
|
||||
/**
|
||||
* Remove a specified AbilityMonitor object from the application memory.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param monitor AbilityMonitor object
|
||||
*/
|
||||
removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<void>): void;
|
||||
@ -45,6 +50,9 @@ export interface AbilityDelegator {
|
||||
|
||||
/**
|
||||
* Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param monitor AbilityMonitor object
|
||||
* @param timeout Maximum wait time, in milliseconds
|
||||
* @return success: return the Ability object, failure: return null
|
||||
@ -55,19 +63,28 @@ export interface AbilityDelegator {
|
||||
|
||||
/**
|
||||
* Obtain the application context.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @return App Context
|
||||
*/
|
||||
getAppContext(): Context;
|
||||
|
||||
/**
|
||||
* Obtain the lifecycle state of a specified ability.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param ability The Ability object
|
||||
* @return The state of the Ability object
|
||||
* @return The state of the Ability object. enum AbilityLifecycleState
|
||||
*/
|
||||
getAbilityState(ability: Ability): number;
|
||||
|
||||
/**
|
||||
* Obtain the ability that is currently being displayed.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @return The top ability of the current application
|
||||
*/
|
||||
getCurrentTopAbility(callback: AsyncCallback<Ability>): void;
|
||||
@ -75,6 +92,9 @@ export interface AbilityDelegator {
|
||||
|
||||
/**
|
||||
* Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param ability The ability object
|
||||
* @return true: success false: failure
|
||||
*/
|
||||
@ -83,6 +103,9 @@ export interface AbilityDelegator {
|
||||
|
||||
/**
|
||||
* Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param ability The ability object
|
||||
* @return true: success false: failure
|
||||
*/
|
||||
@ -92,6 +115,9 @@ export interface AbilityDelegator {
|
||||
/**
|
||||
* Prints log information to the unit testing console.
|
||||
* The total length of the log information to be printed cannot exceed 1000 characters.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param msg Log information
|
||||
*/
|
||||
print(msg: string, callback: AsyncCallback<void>): void;
|
||||
@ -99,6 +125,9 @@ export interface AbilityDelegator {
|
||||
|
||||
/**
|
||||
* Execute the given command in the aa tools side.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @param cmd Shell command
|
||||
* @param timeoutSecs Timeout, in seconds
|
||||
* @return ShellCmdResult object
|
||||
@ -110,9 +139,12 @@ export interface AbilityDelegator {
|
||||
/**
|
||||
* Prints log information to the unit testing console.
|
||||
* The total length of the log information to be printed cannot exceed 1000 characters.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @hide
|
||||
* @param msg Log information
|
||||
* @param code Result code
|
||||
* @hide
|
||||
*/
|
||||
finishTest(msg: string, code: number, callback: AsyncCallback<void>): void;
|
||||
finishTest(msg: string, code: number): Promise<void>;
|
||||
|
15
api/application/abilityDelegatorArgs.d.ts
vendored
15
api/application/abilityDelegatorArgs.d.ts
vendored
@ -18,29 +18,40 @@
|
||||
* Store unit testing-related parameters, including test case names, and test runner name.
|
||||
*
|
||||
* @since 9
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @import import AbilityDelegatorArgs from 'application/abilityDelegatorArgs.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface AbilityDelegatorArgs {
|
||||
/**
|
||||
* the bundle name of the application being tested.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
bundleName: string;
|
||||
|
||||
/**
|
||||
* the parameters used for unit testing.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
parameters: {[key: string]: string};
|
||||
|
||||
/**
|
||||
* the class names of all test cases.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
testCaseNames: string;
|
||||
|
||||
/**
|
||||
* the class name of the test runner used to execute test cases.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
testRunnerClassName: string;
|
||||
}
|
||||
|
27
api/application/abilityMonitor.d.ts
vendored
27
api/application/abilityMonitor.d.ts
vendored
@ -18,49 +18,72 @@
|
||||
* The most recently matched Ability objects will be saved in the AbilityMonitor object.
|
||||
*
|
||||
* @since 9
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @import import AbilityMonitor from 'application/abilityMonitor.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface AbilityMonitor {
|
||||
/**
|
||||
* The name of the ability to monitor.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
abilityName: string;
|
||||
|
||||
/**
|
||||
* Called back when the ability is started for initialization.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onAbilityCreate?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when the state of the ability changes to foreground.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onAbilityForeground?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when the state of the ability changes to background.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onAbilityBackground?:() => void;
|
||||
|
||||
/**
|
||||
* Called back before the ability is destroyed.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onAbilityDestroy?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when an ability window stage is created.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onWindowStageCreate?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when an ability window stage is restored.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onWindowStageRestore?:() => void;
|
||||
|
||||
/**
|
||||
* Called back when an ability window stage is destroyed.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
onWindowStageDestroy?:() => void;
|
||||
}
|
||||
|
9
api/application/shellCmdResult.d.ts
vendored
9
api/application/shellCmdResult.d.ts
vendored
@ -17,19 +17,24 @@
|
||||
* A object that records the result of shell command executes.
|
||||
*
|
||||
* @since 9
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @import import ShellCmdResult from 'application/shellCmdResult.d'
|
||||
* @permission N/A
|
||||
*/
|
||||
export interface ShellCmdResult {
|
||||
/**
|
||||
* the cmd standard result.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
stdResult: String;
|
||||
|
||||
/**
|
||||
* shell cmd exec result.
|
||||
*
|
||||
* @since 9
|
||||
* @sysCap SystemCapability.Ability.AbilityRuntime.Core
|
||||
*/
|
||||
exitCode: number;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user