diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md index cda0e7434c169a4e2dfdba1c06f21ca8cc6a59f8..841c76981a4114564a6a099e82c881390069d9d2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md @@ -7,14 +7,12 @@ AbilityLifecycleCallback模块提供应用上下文[ApplicationContext](js-apis- > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 - ## 导入模块 ```ts import AbilityLifecycleCallback from '@ohos.app.ability.AbilityLifecycleCallback'; ``` - ## AbilityLifecycleCallback.onAbilityCreate onAbilityCreate(ability: UIAbility): void; diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 94ac177abec2771b0bda6c3f0413b97bea8f8ec8..0cb5991ceef6ee1f62cc66af3a9552021a2f46d5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -11,7 +11,6 @@ appRecovery模块提供了应用在故障状态下的恢复能力。 import appRecovery from '@ohos.app.ability.appRecovery'; ``` - ## appRecovery.RestartFlag 应用重启标志,[enableAppRecovery](#apprecoveryenableapprecovery)接口重启选项参数,该类型为枚举。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md index 1affde15177fd27edca009fe043bd7a9bc118332..a5fa20a5aa0977e3743ef1cf4ea5132d568354d7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md @@ -1,11 +1,17 @@ # AbilityResult -定义Ability被拉起并退出后返回的结果码和数据,可以通过[startAbilityForResult](js-apis-ability-context.md#abilitycontextstartabilityforresult)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-ability-context.md#abilitycontextterminateselfwithresult)返回AbilityResult对象。 +定义Ability被拉起并退出后返回的结果码和数据,可以通过[startAbilityForResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilityforresult)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)返回AbilityResult对象。 > **说明:** > > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import ability from '@ohos.ability.ability'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase | 名称 | 可读 | 可写 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md index 155f5f5b314faa7d8cd4426b9e593101a79f1bc7..2d566a8c32ce6d5e754d4e82f407cdd91872187b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md @@ -2,6 +2,12 @@ 在连接指定的后台服务时作为入参,用于接收连接过程中的状态变化,如作为[connectServiceExtensionAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextconnectserviceextensionability)的入参,连接指定的ServiceExtensionAbility。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 参数名 | 类型 | 必填 | 说明 | @@ -18,7 +24,7 @@ abilityName: 'MyAbility' }; - let connectOptions = { + let connectOptions: common.ConnectOptions = { onConnect(elementName, remote) { console.log('onConnect elementName: ${elementName}'); }, diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md index f1e4e395e42bbc0028263ed54067757e07961c91..695ccd431c4d090abd9d9f3c620deeb2353b93f4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md @@ -7,6 +7,12 @@ > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在FA模型下使用。 +## 导入模块 + +```ts +import ability from '@ohos.ability.ability'; +``` + ## 使用说明 使用前根据具体情况引入如下模块 @@ -35,7 +41,7 @@ openFile(uri: string, mode: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let mode = 'rw'; @@ -73,7 +79,7 @@ openFile(uri: string, mode: string): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let mode = 'rw'; @@ -102,7 +108,7 @@ on(type: 'dataChange', uri: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); function onChangeNotify() { @@ -135,7 +141,7 @@ off(type: 'dataChange', uri: string, callback?: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); function onChangeNotify() { @@ -171,7 +177,7 @@ getType(uri: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.getType('dataability:///com.example.DataAbility', (error, data) => { @@ -207,7 +213,7 @@ getType(uri: string): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.getType('dataability:///com.example.DataAbility').then((data) => { @@ -235,7 +241,7 @@ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback { @@ -272,7 +278,7 @@ getFileTypes(uri: string, mimeTypeFilter: string): Promise\> ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.getFileTypes('dataability:///com.example.DataAbility', 'image/*').then((data) => { @@ -299,7 +305,7 @@ normalizeUri(uri: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.normalizeUri('dataability:///com.example.DataAbility', (error, data) => { @@ -335,7 +341,7 @@ normalizeUri(uri: string): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.normalizeUri('dataability:///com.example.DataAbility',).then((data) => { @@ -362,7 +368,7 @@ denormalizeUri(uri: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.denormalizeUri('dataability:///com.example.DataAbility', (error, data) => { @@ -398,7 +404,7 @@ denormalizeUri(uri: string): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.denormalizeUri('dataability:///com.example.DataAbility',).then((data) => { @@ -425,7 +431,7 @@ notifyChange(uri: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.notifyChange('dataability:///com.example.DataAbility', (error) => { @@ -461,7 +467,7 @@ notifyChange(uri: string): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); DAHelper.notifyChange('dataability:///com.example.DataAbility').then(() => { @@ -489,7 +495,7 @@ insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); const valueBucket = { @@ -566,7 +572,7 @@ batchInsert(uri: string, valuesBuckets: Array\, callback: Asyn ```ts import featureAbility from '@ohos.ability.featureAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let cars = new Array({'name': 'roe11', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, @@ -606,7 +612,7 @@ batchInsert(uri: string, valuesBuckets: Array): Promise\, predicates: dataAbility.DataAbilityP ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let cars=new Array('value1', 'value2', 'value3', 'value4'); @@ -834,7 +840,7 @@ query(uri: string, columns?: Array\, predicates?: dataAbility.DataAbilit ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -let DAHelper = featureAbility.acquireDataAbilityHelper( +let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let cars = new Array('value1', 'value2', 'value3', 'value4'); @@ -867,7 +873,7 @@ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCa ```ts import featureAbility from '@ohos.ability.featureAbility'; -let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( +let dataAbilityHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.jsapidemo.UserDataAbility' ); dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility', @@ -908,7 +914,7 @@ call(uri: string, method: string, arg: string, extras: PacMap): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( +let dataAbilityHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.jsapidemo.UserDataAbility' ); dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility', @@ -942,7 +948,7 @@ import featureAbility from '@ohos.ability.featureAbility'; // 根据DataAbilityOperation列表选择要对数据库做的操作 let op=new Array(); -let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( +let dataAbilityHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.jsapidemo.UserDataAbility' ); dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op, (error, data) => { @@ -982,7 +988,7 @@ import featureAbility from '@ohos.ability.featureAbility'; // 根据DataAbilityOperation列表选择要对数据库做的操作 let op=new Array(); -let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( +let dataAbilityHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.jsapidemo.UserDataAbility' ); dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op).then((data) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityOperation.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityOperation.md index fb0b5031cbb9d9a52e8916a7c3e65c12c86e503d..542a1a2f1bdeb58d17ab63e2f5a09bf2bdad341f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityOperation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityOperation.md @@ -7,6 +7,12 @@ > 本接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本接口仅可在FA模型下使用 +## 导入模块 + +```ts +import ability from '@ohos.ability.ability'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.FAModel | 名称 | 类型 | 必填| 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md index 5afc8692841976d2ee9438812d521c17f0c4a928..943a8bd636ce9a1bc71707a261163e56b8faed6d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md @@ -7,6 +7,12 @@ > 本接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本接口仅可在FA模型下使用 +## 导入模块 + +```ts +import ability from '@ohos.ability.ability'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.FAModel | 名称 | 类型 | 必填 | 说明 | @@ -22,7 +28,7 @@ import featureAbility from '@ohos.ability.featureAbility'; // 批量执行数据库操作 function executeBatchOperation() { let dataAbilityUri = ('dataability:///com.example.myapplication.TestDataAbility'); - let DAHelper; + let DAHelper: ability.DataAbilityHelper; try { DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri); if (DAHelper === null) { @@ -61,7 +67,7 @@ function executeBatchOperation() { try { DAHelper.executeBatch(dataAbilityUri, operations).then((data) => { for (let i = 0; i < data.length; i++) { - let dataAbilityResult = data[i]; + let dataAbilityResult: ability.DataAbilityResult = data[i]; console.log('dataAbilityResult.uri: ${dataAbilityResult.uri}'); console.log('dataAbilityResult.count: ${dataAbilityResult.count}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md index e543f3069098214340da4e095d84e49fc2677c86..a119fe766061daf40bdf0f9e1daed2c8f67ad42d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md @@ -7,6 +7,12 @@ > 本接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本接口仅可在FA模型下使用 +## 导入模块 + +```ts +import ability from '@ohos.ability.ability'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.FAModel | 名称 | 类型 | 必填 | 说明 | @@ -30,7 +36,7 @@ let abilityStartSetting ={ [featureAbility.AbilityStartSetting.DISPLAY_ID_KEY] : 1, }; -let startAbilityParameter = { +let startAbilityParameter: ability.StartAbilityParameter = { want : Want, abilityStartSetting : abilityStartSetting }; diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md index 195a244212a7519294558ab9c7ab1821ec9e81c5..79d4f6929b7f734ba64bc1488e47fc8e5e498b75 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md @@ -6,6 +6,12 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传 > > 本模块首批接口从API version 6开始支持,从API version 9废弃,使用[@ohos.app.ability.Want](js-apis-app-ability-want.md)模块替代。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import Want from '@ohos.app.ability.Want'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase | 名称 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-app-appVersionInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-app-appVersionInfo.md index 40e92540bb94179d0875be7f53075506133dc5f9..d08a4d237ec97b5a76bc22a1fa11a206720871ad 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-app-appVersionInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-app-appVersionInfo.md @@ -6,6 +6,12 @@ > > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import featureAbility from '@ohos.ability.featureAbility'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 可读 | 可写 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md b/zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md index d104043ca364126c707f27a2fb159163f0af2f16..bbdaed0f3c5ceb4d49057e5c03fcd67f7caf03af 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md @@ -7,13 +7,19 @@ Context模块提供了ability或application的上下文的能力,包括允许 > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口**仅可在FA模型**下使用。 +## 导入模块 + +```ts +import featureAbility from '@ohos.ability.featureAbility'; +``` + ## 使用说明 Context对象是在featureAbility中创建实例,并通过featureAbility的[getContext](js-apis-ability-featureAbility.md#featureabilitygetcontext)接口返回,因此在使用Context时,必须导入@ohos.ability.featureAbility库。示例如下: ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getOrCreateLocalDir().then((data) => { console.info('getOrCreateLocalDir data: ${JSON.stringify(data)}'); }); @@ -39,7 +45,7 @@ getOrCreateLocalDir(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getOrCreateLocalDir((error, data)=>{ if (error && error.code !== 0) { console.error('getOrCreateLocalDir fail, error: ${JSON.stringify(error)}'); @@ -71,7 +77,7 @@ getOrCreateLocalDir(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getOrCreateLocalDir().then((data) => { console.info('getOrCreateLocalDir data: ${JSON.stringify(data)}'); }); @@ -98,7 +104,7 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async ```ts import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle.bundleManager'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); bundle.getBundleInfo('com.context.test', 1, (err, datainfo) =>{ context.verifyPermission('com.example.permission', {uid:datainfo.appInfo.uid}, (error, data) =>{ if (error && error.code !== 0) { @@ -132,7 +138,7 @@ verifyPermission(permission: string, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.verifyPermission('com.example.permission', (error, data) =>{ if (error && error.code !== 0) { console.error('verifyPermission fail, error: ${JSON.stringify(error)}'); @@ -167,7 +173,7 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\ { console.info('verifyPermission data: ${JSON.stringify(data)}'); @@ -196,7 +202,7 @@ requestPermissionsFromUser(permissions: Array\, requestCode: number, res ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.requestPermissionsFromUser( ['com.example.permission1', 'com.example.permission2', @@ -240,7 +246,7 @@ requestPermissionsFromUser(permissions: Array\, requestCode: number): Pr ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.requestPermissionsFromUser( ['com.example.permission1', 'com.example.permission2', @@ -273,7 +279,7 @@ getApplicationInfo(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getApplicationInfo((error, data) => { if (error && error.code !== 0) { console.error('getApplicationInfo fail, error: ${JSON.stringify(error)}'); @@ -303,7 +309,7 @@ getApplicationInfo(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getApplicationInfo().then((data) => { console.info('getApplicationInfo data: ${JSON.stringify(data)}'); }); @@ -329,7 +335,7 @@ getBundleName(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getBundleName((error, data) => { if (error && error.code !== 0) { console.error('getBundleName fail, error: ${JSON.stringify(error)}'); @@ -359,7 +365,7 @@ getBundleName(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getBundleName().then((data) => { console.info('getBundleName data: ${JSON.stringify(data)}'); }); @@ -383,7 +389,7 @@ getDisplayOrientation(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getDisplayOrientation((error, data) => { if (error && error.code !== 0) { console.error('getDisplayOrientation fail, error: ${JSON.stringify(error)}'); @@ -411,7 +417,7 @@ getDisplayOrientation(): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getDisplayOrientation().then((data) => { console.info('getDisplayOrientation data: ${JSON.stringify(data)}'); }); @@ -435,7 +441,7 @@ getExternalCacheDir(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getExternalCacheDir((error, data) => { if (error && error.code !== 0) { console.error('getExternalCacheDir fail, error: ${JSON.stringify(error)}'); @@ -463,7 +469,7 @@ getExternalCacheDir(): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getExternalCacheDir().then((data) => { console.info('getExternalCacheDir data: ${JSON.stringify(data)}'); }); @@ -489,7 +495,7 @@ setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCal ```ts import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); let orientation = bundle.DisplayOrientation.UNSPECIFIED; context.setDisplayOrientation(orientation, (error) => { console.error('setDisplayOrientation fail, error: ${JSON.stringify(error)}'); @@ -516,7 +522,7 @@ setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); let orientation = bundle.DisplayOrientation.UNSPECIFIED; context.setDisplayOrientation(orientation).then((data) => { console.info('setDisplayOrientation data: ${JSON.stringify(data)}'); @@ -542,7 +548,7 @@ setShowOnLockScreen(show: boolean, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); let show = true; context.setShowOnLockScreen(show, (error) => { console.error('setShowOnLockScreen fail, error: ${JSON.stringify(error)}'); @@ -573,7 +579,7 @@ setShowOnLockScreen(show: boolean): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); let show = true; context.setShowOnLockScreen(show).then((data) => { console.info('setShowOnLockScreen data: ${JSON.stringify(data)}'); @@ -599,7 +605,7 @@ setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); let wakeUp = true; context.setWakeUpScreen(wakeUp, (error) => { console.error('setWakeUpScreen fail, error: ${JSON.stringify(error)}'); @@ -630,7 +636,7 @@ setWakeUpScreen(wakeUp: boolean): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); let wakeUp = true; context.setWakeUpScreen(wakeUp).then((data) => { console.info('setWakeUpScreen data: ${JSON.stringify(data)}'); @@ -658,7 +664,7 @@ getProcessInfo(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getProcessInfo((error, data) => { if (error && error.code !== 0) { console.error('getProcessInfo fail, error: ${JSON.stringify(error)}'); @@ -688,7 +694,7 @@ getProcessInfo(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getProcessInfo().then((data) => { console.info('getProcessInfo data: ${JSON.stringify(data)}'); }); @@ -716,7 +722,7 @@ getElementName(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getElementName((error, data) => { if (error && error.code !== 0) { console.error('getElementName fail, error: ${JSON.stringify(error)}'); @@ -748,7 +754,7 @@ getElementName(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getElementName().then((data) => { console.info('getElementName data: ${JSON.stringify(data)}'); }); @@ -772,7 +778,7 @@ getProcessName(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getProcessName((error, data) => { if (error && error.code !== 0) { console.error('getProcessName fail, error: ${JSON.stringify(error)}'); @@ -802,7 +808,7 @@ getProcessName(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getProcessName().then((data) => { console.info('getProcessName data: ${JSON.stringify(data)}'); }); @@ -828,7 +834,7 @@ getCallingBundle(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getCallingBundle((error, data) => { if (error && error.code !== 0) { console.error('getCallingBundle fail, error: ${JSON.stringify(error)}'); @@ -858,7 +864,7 @@ getCallingBundle(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getCallingBundle().then((data) => { console.info('getCallingBundle data: ${JSON.stringify(data)}'); }); @@ -882,7 +888,7 @@ getCacheDir(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getCacheDir((error, data) => { if (error && error.code !== 0) { console.error('getCacheDir fail, error: ${JSON.stringify(error)}'); @@ -910,7 +916,7 @@ getCacheDir(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getCacheDir().then((data) => { console.info('getCacheDir data: ${JSON.stringify(data)}'); }); @@ -934,7 +940,7 @@ getFilesDir(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getFilesDir((error, data) => { if (error && error.code !== 0) { console.error('getFilesDir fail, error: ${JSON.stringify(error)}'); @@ -962,7 +968,7 @@ getFilesDir(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getFilesDir().then((data) => { console.info('getFilesDir data: ${JSON.stringify(data)}'); }); @@ -988,7 +994,7 @@ getOrCreateDistributedDir(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getOrCreateDistributedDir((error, data) => { if (error && error.code !== 0) { console.error('getOrCreateDistributedDir fail, error: ${JSON.stringify(error)}'); @@ -1018,7 +1024,7 @@ getOrCreateDistributedDir(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getOrCreateDistributedDir().then((data) => { console.info('getOrCreateDistributedDir data: ${JSON.stringify(data)}'); }); @@ -1042,7 +1048,7 @@ getAppType(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getAppType((error, data) => { if (error && error.code !== 0) { console.error('getAppType fail, error: ${JSON.stringify(error)}'); @@ -1070,7 +1076,7 @@ getAppType(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getAppType().then((data) => { console.info('getAppType data: ${JSON.stringify(data)}'); }); @@ -1094,7 +1100,7 @@ getHapModuleInfo(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getHapModuleInfo((error, data) => { if (error && error.code !== 0) { console.error('getHapModuleInfo fail, error: ${JSON.stringify(error)}'); @@ -1122,7 +1128,7 @@ getHapModuleInfo(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getHapModuleInfo().then((data) => { console.info('getHapModuleInfo data: ${JSON.stringify(data)}'); }); @@ -1146,7 +1152,7 @@ getAppVersionInfo(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getAppVersionInfo((error, data) => { if (error && error.code !== 0) { console.error('getAppVersionInfo fail, error: ${JSON.stringify(error)}'); @@ -1174,7 +1180,7 @@ getAppVersionInfo(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getAppVersionInfo().then((data) => { console.info('getAppVersionInfo data: ${JSON.stringify(data)}'); }); @@ -1198,7 +1204,7 @@ getAbilityInfo(callback: AsyncCallback\): void ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getAbilityInfo((error, data) => { if (error && error.code !== 0) { console.error('getAbilityInfo fail, error: ${JSON.stringify(error)}'); @@ -1226,7 +1232,7 @@ getAbilityInfo(): Promise\ ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.getAbilityInfo().then((data) => { console.info('getAbilityInfo data: ${JSON.stringify(data)}'); }); @@ -1250,7 +1256,7 @@ getApplicationContext(): Context ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext().getApplicationContext(); +let context: featureAbility.Context = featureAbility.getContext().getApplicationContext(); ``` ## Context.isUpdatingConfigurations7+ @@ -1271,7 +1277,7 @@ isUpdatingConfigurations(callback: AsyncCallback\): void; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.isUpdatingConfigurations((error, data) => { if (error && error.code !== 0) { console.error('isUpdatingConfigurations fail, error: ${JSON.stringify(error)}'); @@ -1299,7 +1305,7 @@ isUpdatingConfigurations(): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.isUpdatingConfigurations().then((data) => { console.info('isUpdatingConfigurations data: ${JSON.stringify(data)}'); }); @@ -1323,7 +1329,7 @@ printDrawnCompleted(callback: AsyncCallback\): void; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.printDrawnCompleted((err) => { console.error('printDrawnCompleted err: ${JSON.stringify(err)}'); }); @@ -1347,7 +1353,7 @@ printDrawnCompleted(): Promise\; ```ts import featureAbility from '@ohos.ability.featureAbility'; -let context = featureAbility.getContext(); +let context: featureAbility.Context = featureAbility.getContext(); context.printDrawnCompleted().then((data) => { console.info('printDrawnCompleted data: ${JSON.stringify(data)}'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md index a9bebeaa2937d4f9a07023707c1abe2b2b5139d2..bf576fce0b4b592a0a3b4c847e00310c625deecb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md @@ -6,6 +6,12 @@ > > 本模块首批接口从API version 7开始支持,仅支持FA模型。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import featureAbility from '@ohos.ability.featureAbility'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 可读 | 可写 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md index 2a99f0569c097c6f367159fde9d8ae161f29d6ea..3091b7c65bc899821eebd41d50d2d875fea28a81 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md @@ -6,6 +6,12 @@ AbilityDelegator提供添加用于监视指定ability的生命周期状态更改 > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +``` + ## 使用说明 通过AbilityDelegatorRegistry中[getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator)方法获取。 @@ -33,7 +39,7 @@ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): void **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; function onAbilityCreateCallback(data) { console.info('onAbilityCreateCallback, data: ${JSON.stringify(data)}'); @@ -73,7 +79,7 @@ addAbilityMonitor(monitor: AbilityMonitor): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; function onAbilityCreateCallback(data) { console.info('onAbilityCreateCallback'); @@ -108,7 +114,7 @@ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): v **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; function onAbilityCreateCallback(data) { console.info('onAbilityCreateCallback'); @@ -148,7 +154,7 @@ removeAbilityMonitor(monitor: AbilityMonitor): Promise\; - 示例 ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; function onAbilityCreateCallback(data) { console.info('onAbilityCreateCallback'); @@ -183,7 +189,7 @@ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\) **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; function onAbilityCreateCallback(data) { console.info('onAbilityCreateCallback'); @@ -223,7 +229,7 @@ waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCall **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let timeout = 100; function onAbilityCreateCallback(data) { @@ -271,7 +277,7 @@ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -390,7 +396,7 @@ getCurrentTopAbility(): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -418,7 +424,7 @@ startAbility(want: Want, callback: AsyncCallback\): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let want = { bundleName: 'bundleName', abilityName: 'abilityName' @@ -453,7 +459,7 @@ startAbility(want: Want): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let want = { bundleName: 'bundleName', abilityName: 'abilityName' @@ -483,7 +489,7 @@ doAbilityForeground(ability: UIAbility, callback: AsyncCallback\): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -519,7 +525,7 @@ doAbilityForeground(ability: UIAbility): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -550,7 +556,7 @@ doAbilityBackground(ability: UIAbility, callback: AsyncCallback\): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -586,7 +592,7 @@ doAbilityBackground(ability: UIAbility): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -616,7 +622,7 @@ printSync(msg: string): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -641,7 +647,7 @@ print(msg: string, callback: AsyncCallback\): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -673,7 +679,7 @@ print(msg: string): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -700,7 +706,7 @@ executeShellCommand(cmd: string, callback: AsyncCallback\): void **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let cmd = 'cmd'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -728,7 +734,7 @@ executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\ **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let cmd = 'cmd'; let timeout = 100; @@ -791,7 +797,7 @@ finishTest(msg: string, code: number, callback: AsyncCallback\): void; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -824,7 +830,7 @@ finishTest(msg: string, code: number): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -851,7 +857,7 @@ addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let monitor = { moduleName: 'moduleName', @@ -918,7 +924,7 @@ removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\ **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let monitor = { moduleName: 'moduleName', @@ -954,7 +960,7 @@ removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\; **示例:** ```ts -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let monitor = { moduleName: 'moduleName', @@ -985,7 +991,7 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\ > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +``` + ## 使用说明 通过AbilityDelegatorRegistry中[getArguments](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetarguments)方法获取。 @@ -28,5 +34,5 @@ AbilityDelegatorArgs模块提供在应用程序执行测试用例期间,获取 ```ts import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -let args = AbilityDelegatorRegistry.getArguments(); +let args: AbilityDelegatorRegistry.AbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments(); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md index 653b7e8d2c99736c7b04ba7d49e3f74c2a8c470a..10c51deb50402427679432a18301e3e9a1937699 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md @@ -6,6 +6,12 @@ AbilityMonitor模块提供匹配满足指定条件的受监视能力对象的方 > > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +``` + ## 使用说明 可以作为abilityDelegator中的[addAbilityMonitor](js-apis-inner-application-abilityDelegator.md#addabilitymonitor9)的入参来监听指定Ability的生命周期变化。 @@ -43,7 +49,7 @@ let monitor = { onAbilityCreate: onAbilityCreateCallback }; -let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityMonitor(monitor, (error : any) => { if (error && error.code !== 0) { console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md index cc5aa4a04b72ddad8073f7a0f1d2f508c0862ee9..b3c377089bd40d60bf31c217380d4ab290f49807 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md @@ -6,6 +6,12 @@ AbilityRunningInfo模块提供对Ability运行的相关信息和状态的定义 > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import abilitymanager from '@ohos.app.ability.abilityManager'; +``` + ## 使用说明 通过abilityManager中[getAbilityRunningInfos](js-apis-app-ability-abilityManager.md#getabilityrunninginfos)方法获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md index 1224bc0b62dc439e42aa88edfc4dde577156bff2..7fe09d0a0f59f4eef5bc7ecb6d55a5180bfd60fd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md @@ -9,6 +9,12 @@ AbilityStageContext提供允许访问特定于abilityStage的资源的能力, > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 使用说明 通过AbilityStage实例来获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md index feb761168adbd83a89b4bab41d498e9cc71e4b56..c9551f02be895aafa02ecf0d4f72dc66e46ab670 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md @@ -1,6 +1,7 @@ # AbilityStageMonitor -提供用于匹配满足指定条件的受监视的AbilityStage对象的方法。最近匹配的AbilityStage对象将保存在AbilityStageMonitor对象中。 +提供用于匹配满足指定条件的受监视的AbilityStage对象的方法。最近匹配的AbilityStage对象将保存在AbilityStageMonitor对象中。 + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md index 584ac2a1771157596f460a721f6239a28981ea65..2cef28495ec2547701b73bc448f1566fd8784bc2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md @@ -2,6 +2,12 @@ 定义Ability状态信息,可以通过[registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8)注册生命周期变化监听后,通过[ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md)的onAbilityStateChanged生命周期回调获取。 +## 导入模块 + +```ts +import appManager from '@ohos.application.appManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 可读 | 可写 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md index 5c8754dc11a5a7e2c7cb4dfe2bb381835113e465..363a51420a952347b32b14c816b2be614c09272d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -2,6 +2,12 @@ 定义应用状态信息,可以通过[getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications)获取当前应用的相关信息。 +## 导入模块 + +```ts +import appManager from '@ohos.app.ability.appManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core **系统API**:本模块被标记为@systemapi,对三方应用隐藏 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index 064e036e1a0e3a95440c202d04e1d5c98797d329..2f195fb0389a7f8e052f14d50b3adcee84e8e20a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -7,12 +7,18 @@ ApplicationContext模块提供开发者应用级别的的上下文的能力, > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 使用说明 在使用ApplicationContext的功能前,需要通过context的实例获取。 ```ts -let applicationContext = this.context.getApplicationContext(); +let applicationContext: common.ApplicationContext = this.context.getApplicationContext(); ``` ## ApplicationContext.on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback) diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md index f8d9dc2f305c257ad75f4505d6ced5222c9bf006..7703381ce8b86f09904229d58204727c44850d34 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md @@ -2,6 +2,12 @@ 定义应用状态监听,可以作为[registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8)的入参监听当前应用的生命周期变化。 +## 导入模块 + +```ts +import appManager from '@ohos.application.appManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core **系统API**:该接口为系统接口,三方应用不支持调用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md index e4880695fa4910651ec7fe8c754782f6e68c368c..b0873a6584d298daf7a18c429d2e2fadb8e10466 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md @@ -6,6 +6,12 @@ BaseContext抽象类用于表示继承的子类Context是Stage模型还是FA模 > > 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + **系统能力**:SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 可读 | 可写 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md index 618cae585d94f5d1bbfbfd1204672925147bd38d..3936d4c485f690e848baa2e22216f5e308b428d4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md @@ -7,6 +7,12 @@ Context模块提供了ability或application的上下文的能力,包括访问 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 属性 **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core @@ -58,7 +64,7 @@ createBundleContext(bundleName: string): Context; **示例:** ```ts -let bundleContext; +let bundleContext: common.Context; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { @@ -97,7 +103,7 @@ createModuleContext(moduleName: string): Context; **示例:** ```ts -let moduleContext; +let moduleContext: common.Context; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { @@ -137,7 +143,7 @@ createModuleContext(bundleName: string, moduleName: string): Context; **示例:** ```ts -let moduleContext; +let moduleContext: common.Context; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { @@ -162,7 +168,7 @@ getApplicationContext(): ApplicationContext; **示例:** ```ts -let applicationContext; +let applicationContext: common.Context; try { applicationContext = this.context.getApplicationContext(); } catch (error) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index d18486f4fff03e6e5066159985929df272fb207d..46a1b54087b0913c43076e74d79fdc0e9e8475b6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -2,6 +2,12 @@ 定义异常监听,可以作为[ErrorManager.on](js-apis-app-ability-errorManager.md#errormanageron)的入参监听当前应用发生的异常。 +## 导入模块 + +```ts +import errorManager from '@ohos.app.ability.errorManager'; +``` + ## ErrorObserver.onUnhandledException onUnhandledException(errMsg: string): void; diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-eventHub.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-eventHub.md index 007ed061dbcb87b390e9ce63a5c56b5bc895dc38..6eadc7733931235f97b8142ed1df2de615c0b162 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-eventHub.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-eventHub.md @@ -7,6 +7,12 @@ EventHub模块提供了事件中心,提供订阅、取消订阅、触发事件 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 使用说明 在使用eventHub的功能前,需要通过UIAbility实例的成员变量context获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionContext.md index d2b0afaae92caf7b9b4843891cbcf76a58345dd0..45618ac37bc34995f48fdfb5f368ca30ed14f802 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionContext.md @@ -9,6 +9,12 @@ ExtensionContext模块提供访问特定Extension的资源的能力,对于拓 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 属性 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 37e2743da7dd4cc4f1d2f8b63c4cf310edad4da1..3031cb719e1f61ea128c441df0bfa199c669c55b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -7,6 +7,12 @@ ExtensionRunningInfo模块封装了Extension运行的相关信息,可以通过 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块被标记为@systemapi,对三方应用隐藏 +## 导入模块 + +```ts +import abilityManager from '@ohos.app.ability.abilityManager'; +``` + ## 使用说明 导入abilityManager模块,通过调用abilityManager中的方法获取ExtensionRunningInfo。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md index 15734b7eb09bd941548b4ec9f1cfd6a63fe4697d..4abd6286eecd6e115c82556825244a116284f590 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md @@ -9,6 +9,12 @@ FormExtensionContext模块提供FormExtensionAbility具有的接口和能力。 > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 使用说明 在使用FormExtensionContext的功能前,需要通过FormExtensionAbility获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index 389f8af0a9dfe2e91a2adaa8b3e345c6491bfab6..0713f73398d0dc7a923b6c884ef466d3b235fe84 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -2,6 +2,12 @@ 表示任务的详细信息,可以通过[getMissionInfo](js-apis-app-ability-missionManager.md#missionmanagergetmissioninfo)获取。 +## 导入模块 + +```ts +import missionManager from '@ohos.app.ability.missionManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission **系统API**: 此接口为系统接口,三方应用不支持调用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md index 4cd21a38f960a8018100082cd70ad502b6722477..8e0b2dec0b4b1b40999223c53ba731c38460ac03 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md @@ -2,6 +2,12 @@ 定义系统任务状态监听,可以通过[on](js-apis-app-ability-missionManager.md#missionmanageron)注册。 +## 导入模块 + +```ts +import missionManager from '@ohos.app.ability.missionManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission | 名称 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index df07e847693276b618c1b13b6fa906f85782577b..25a67ece99c78e930b8ee71237a50892f35c228d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -7,6 +7,12 @@ > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口均为系统接口,三方应用不支持调用 +## 导入模块 + +```ts +import missionManager from '@ohos.app.ability.missionManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission | 名称 | 类型 | 可读 | 可写 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md index 2911b0e31fc72b50844f78c37dbeb2e8d26ff2d9..dd7e07b1eaa060407ad109934d1a1dbbeb52bf4f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md @@ -2,6 +2,12 @@ 进程数据的对象定义。使用接口[registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8)注册生命周期变化监听后,当应用或组件的生命周期变化时,系统通过[ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md)的onProcessCreated等方法回调给开发者。 +## 导入模块 + +```ts +import appManager from '@ohos.app.ability.appManager'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core **系统API**:该接口为系统接口,三方应用不支持调用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md index 67d68c40c1955e6ed325c03e8a70687bbba5162e..5f971e236720c52de630034b694a4ff552309f02 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md @@ -6,6 +6,12 @@ ProcessInformation模块提供对进程运行信息进行查询的能力。 > > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import appManager from '@ohos.app.ability.appManager'; +``` + ## 使用说明 通过appManager的[getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9)来获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md index 9a1b0c18cf3779c7e5f5c3f6473d505651648b86..406abc4babfa5a369ed745f26d50272f83536f75 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md @@ -6,6 +6,12 @@ > - 本模块接口从API version 9 开始废弃,建议使用[ProcessInformation9+](js-apis-inner-application-processInformation.md)替代。 > - 本模块首批接口从API version 8 开始支持。 +## 导入模块 + +```ts +import appManager from '@ohos.app.ability.appManager'; +``` + ## 属性 **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 9e8a8d1c933b74518fc3aa3b0b6ed4b77b9f956b..7e5ffc513c03582c4e2ef656a23e8bc8fbd86f4f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -9,6 +9,12 @@ ServiceExtensionContext模块提供ServiceExtensionAbility具有的能力,包 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 使用说明 在使用ServiceExtensionContext的功能前,需要通过ServiceExtensionAbility子类实例获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md index 35c5f6cf8286d207fb5492bff09f78a0d3ad607d..80ee2c1a580bc848468b3d1d87fcac834baf5815 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md @@ -6,6 +6,12 @@ > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +## 导入模块 + +```ts +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -20,7 +26,7 @@ **示例:** ```ts import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -let abilityDelegator; +let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator; let cmd = 'cmd'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 7d2b3c2fd04e462648c22379121bb81726d246a9..892dfe48dbfa3b7ab6e987ff31842442e0ea0905 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -7,6 +7,12 @@ UIAbilityContext是[UIAbility](js-apis-app-ability-uiAbility.md)的上下文环 > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块接口仅可在Stage模型下使用。 +## 导入模块 + +```ts +import common from '@ohos.app.ability.common'; +``` + ## 属性 **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md index 2feb49eca2b637434e9ed21bb79fcf4c1b64ea71..3345add89f7cbba6c1b60b64454334b63b5e0cbc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md @@ -2,6 +2,12 @@ 作为[trigger](js-apis-app-ability-wantAgent.md#wantagenttrigger)的入参定义触发WantAgent所需要的信息。 +## 导入模块 + +```ts +import wantAgent from '@ohos.app.ability.wantAgent'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md index 89ce97b7c59ca5a281ce86f3c729a05ad02a07be..57a65ccf897b57b2cba22e339d06c6bce320b709 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md @@ -2,6 +2,12 @@ 定义触发WantAgent所需要的信息,可以作为[getWantAgent](js-apis-app-ability-wantAgent.md#wantagentgetwantagent)的入参创建指定的WantAgent对象。 +## 导入模块 + +```ts +import wantAgent from '@ohos.app.ability.wantAgent'; +``` + **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 类型 | 必填 | 说明 |