diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md index 20d11f2be48ef3f321a865f9e74c957529c1e73b..85c7596485ee1d52770934fb54e7f60d754397e0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md @@ -13,5 +13,5 @@ MediaControlExtensionAbility模块提供播放控制的扩展能力,继承自[ ## 导入模块 ```js -import MediaControlExtensionAbility from @ohos.app.ability.MediaControlExtensionAbility; +import MediaControlExtensionAbility from '@ohos.app.ability.MediaControlExtensionAbility'; ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-picker.md b/zh-cn/application-dev/reference/apis/js-apis-file-picker.md index 4c48afe9b0c47196d45d0a96c2e0951bd89c08a4..f6e78d77a82562c7a23cbda34fa5fbad1abe5414 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-picker.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-picker.md @@ -10,7 +10,6 @@ ```ts import picker from '@ohos.file.picker'; -import { BusinessError } from '@ohos.base'; ``` ## PhotoViewPicker @@ -48,6 +47,8 @@ select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example01() { try { let PhotoSelectOptions = new picker.PhotoSelectOptions(); @@ -83,6 +84,8 @@ select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult& **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example02() { try { let PhotoSelectOptions = new picker.PhotoSelectOptions(); @@ -119,6 +122,8 @@ select(callback: AsyncCallback<PhotoSelectResult>) : void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example03() { try { let photoPicker = new picker.PhotoViewPicker(); @@ -158,6 +163,8 @@ save(option?: PhotoSaveOptions) : Promise<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example04() { try { let PhotoSaveOptions = new picker.PhotoSaveOptions(); @@ -192,6 +199,8 @@ save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example05() { try { let PhotoSaveOptions = new picker.PhotoSaveOptions(); @@ -227,6 +236,8 @@ save(callback: AsyncCallback<Array<string>>) : void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example06() { try { let photoPicker = new picker.PhotoViewPicker(); @@ -278,6 +289,8 @@ select(option?: DocumentSelectOptions) : Promise<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example07() { try { let DocumentSelectOptions = new picker.DocumentSelectOptions(); @@ -311,6 +324,8 @@ select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example08() { try { let DocumentSelectOptions = new picker.DocumentSelectOptions(); @@ -345,6 +360,8 @@ select(callback: AsyncCallback<Array<string>>) : void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example09() { try { let documentPicker = new picker.DocumentViewPicker(); @@ -385,6 +402,8 @@ save(option?: DocumentSaveOptions) : Promise<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example10() { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); @@ -419,6 +438,8 @@ save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example11() { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); @@ -454,6 +475,8 @@ save(callback: AsyncCallback<Array<string>>) : void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example12() { try { let documentPicker = new picker.DocumentViewPicker(); @@ -505,6 +528,8 @@ select(option?: AudioSelectOptions) : Promise<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example13() { try { let AudioSelectOptions = new picker.AudioSelectOptions(); @@ -538,6 +563,8 @@ select(option: AudioSelectOptions, callback: AsyncCallback<Array<string> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example14() { try { let AudioSelectOptions = new picker.AudioSelectOptions(); @@ -572,6 +599,8 @@ select(callback: AsyncCallback<Array<string>>) : void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example15() { try { let audioPicker = new picker.AudioViewPicker(); @@ -611,6 +640,8 @@ save(option?: AudioSaveOptions) : Promise<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example16() { try { let AudioSaveOptions = new picker.AudioSaveOptions(); @@ -645,6 +676,8 @@ save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example17() { try { let AudioSaveOptions = new picker.AudioSaveOptions(); @@ -680,6 +713,8 @@ save(callback: AsyncCallback<Array<string>>) : void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + async example18() { try { let audioPicker = new picker.AudioViewPicker(); diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md b/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md index ebf5e3263cbe4ba170ec5b789a6c5ce40b6235d6..c85b447f4b4f38ca40d39b7c290654816e2af2d3 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @@ -1,8 +1,7 @@ # @ohos.systemParameter (系统属性) 系统参数(SystemParameter)是为各系统服务提供的简单易用的键值对访问接口,各个系统服务可以定义系统参数来描述该服务的状态信息,或者通过系统参数来改变系统服务的行为。其基本操作原语为get和set,通过get可以查询系统参数的值,通过set可以修改系统参数的值。 -详细的系统参数设计原理及定义可参考 -[系统参数](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)。 +详细的系统参数设计原理及定义可参考[系统参数](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)。 > **说明:** > - 本模块接口从API version 9开始不再维护,建议使用新接口[`@ohos.systemParameterEnhance`](js-apis-system-parameterEnhance.md)替代。 @@ -15,7 +14,6 @@ ```ts import systemparameter from '@ohos.systemparameter'; -import { BusinessError } from '@ohos.base'; ``` ## systemparameter.getSync(deprecated) @@ -68,6 +66,8 @@ get(key: string, callback: AsyncCallback<string>): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.get("const.ohos.apiversion", (err:BusinessError, data:string) => { if (err == undefined) { @@ -99,6 +99,8 @@ get(key: string, def: string, callback: AsyncCallback<string>): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.get("const.ohos.apiversion", "default", (err:BusinessError, data:string) => { if (err == undefined) { @@ -136,6 +138,8 @@ get(key: string, def?: string): Promise<string> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { let p = systemparameter.get("const.ohos.apiversion"); p.then((value:string) => { @@ -201,6 +205,8 @@ set(key: string, value: string, callback: AsyncCallback<void>): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.set("test.parameter.key", "testValue", (err:BusinessError, data:string) =>{ if (err == undefined) { @@ -241,6 +247,8 @@ set(key: string, value: string): Promise<void> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { let p = systemparameter.set("test.parameter.key", "testValue"); p.then((value:string) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-parameterEnhance.md b/zh-cn/application-dev/reference/apis/js-apis-system-parameterEnhance.md index 446d10c87d594a47bee6db382ac098d0ce46ac86..3457a2e4f6131200637d6bdb5ffe260cd7c336c9 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-system-parameterEnhance.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-parameterEnhance.md @@ -1,8 +1,7 @@ # @ohos.systemParameterEnhance (系统参数) 系统参数(SystemParameter)是为各系统服务提供的简单易用的键值对访问接口,各个系统服务可以定义系统参数来描述该服务的状态信息,或者通过系统参数来改变系统服务的行为。其基本操作原语为get和set,通过get可以查询系统参数的值,通过set可以修改系统参数的值。 -详细的系统参数设计原理及定义可参考 -[系统参数](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)。 +详细的系统参数设计原理及定义可参考[系统参数](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)。 > **说明:** > @@ -14,7 +13,6 @@ ```ts import systemparameter from '@ohos.systemParameterEnhance'; -import { BusinessError } from '@ohos.base'; ``` ## systemparameter.getSync @@ -67,6 +65,8 @@ get(key: string, callback: AsyncCallback<string>): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.get("const.ohos.apiversion", (err:BusinessError, data:string) => { if (err == undefined) { @@ -98,6 +98,8 @@ get(key: string, def: string, callback: AsyncCallback<string>): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.get("const.ohos.apiversion", "default", (err:BusinessError, data:string) => { if (err == undefined) { @@ -135,6 +137,8 @@ get(key: string, def?: string): Promise<string> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { let p = systemparameter.get("const.ohos.apiversion"); p.then((value:string) => { @@ -165,6 +169,8 @@ setSync(key: string, value: string): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.setSync("test.parameter.key", "default"); } catch(e) { @@ -191,6 +197,8 @@ set(key: string, value: string, callback: AsyncCallback<void>): void **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { systemparameter.set("test.parameter.key", "testValue", (err:BusinessError, data:string) => { if (err == undefined) { @@ -227,6 +235,8 @@ set(key: string, value: string): Promise<void> **示例:** ```ts +import { BusinessError } from '@ohos.base'; + try { let p = systemparameter.set("test.parameter.key", "testValue"); p.then((value:string) => {