From 83cf4acd3ca86d912dd7dd8be3c92b54274d67ab Mon Sep 17 00:00:00 2001 From: chenshixu1 Date: Mon, 28 Aug 2023 01:49:45 +0000 Subject: [PATCH] fix ark Signed-off-by: chenshixu1 --- .../apis/js-apis-system-parameter.md | 23 ++++++++++--------- .../apis/js-apis-system-parameterEnhance.md | 23 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) 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 813277d8d4..ebf5e3263c 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 @@ -14,7 +14,8 @@ ## 导入模块 ```ts -import systemparameter from '@ohos.systemparameter' +import systemparameter from '@ohos.systemparameter'; +import { BusinessError } from '@ohos.base'; ``` ## systemparameter.getSync(deprecated) @@ -42,7 +43,7 @@ getSync(key: string, def?: string): string ```ts try { - var info = systemparameter.getSync("const.ohos.apiversion"); + let info = systemparameter.getSync("const.ohos.apiversion"); console.log(JSON.stringify(info)); } catch(e) { console.log("getSync unexpected error: " + e); @@ -68,7 +69,7 @@ get(key: string, callback: AsyncCallback<string>): void ```ts try { - systemparameter.get("const.ohos.apiversion", function (err, data) { + systemparameter.get("const.ohos.apiversion", (err:BusinessError, data:string) => { if (err == undefined) { console.log("get test.parameter.key value success:" + data) } else { @@ -99,7 +100,7 @@ get(key: string, def: string, callback: AsyncCallback<string>): void ```ts try { - systemparameter.get("const.ohos.apiversion", "default", function (err, data) { + systemparameter.get("const.ohos.apiversion", "default", (err:BusinessError, data:string) => { if (err == undefined) { console.log("get test.parameter.key value success:" + data) } else { @@ -136,10 +137,10 @@ get(key: string, def?: string): Promise<string> ```ts try { - var p = systemparameter.get("const.ohos.apiversion"); - p.then(function (value) { + let p = systemparameter.get("const.ohos.apiversion"); + p.then((value:string) => { console.log("get test.parameter.key success: " + value); - }).catch(function (err) { + }).catch((err:BusinessError) => { console.log("get test.parameter.key error: " + err.code); }); } catch(e) { @@ -201,7 +202,7 @@ set(key: string, value: string, callback: AsyncCallback<void>): void ```ts try { - systemparameter.set("test.parameter.key", "testValue", function (err, data) { + systemparameter.set("test.parameter.key", "testValue", (err:BusinessError, data:string) =>{ if (err == undefined) { console.log("set test.parameter.key value success :" + data) } else { @@ -241,10 +242,10 @@ set(key: string, value: string): Promise<void> ```ts try { - var p = systemparameter.set("test.parameter.key", "testValue"); - p.then(function (value) { + let p = systemparameter.set("test.parameter.key", "testValue"); + p.then((value:string) => { console.log("set test.parameter.key success: " + value); - }).catch(function (err) { + }).catch((err:BusinessError) => { console.log(" set test.parameter.key error: " + err.code); }); } catch(e) { 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 deb3aa478f..446d10c87d 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 @@ -13,7 +13,8 @@ ## 导入模块 ```ts -import systemparameter from '@ohos.systemParameterEnhance' +import systemparameter from '@ohos.systemParameterEnhance'; +import { BusinessError } from '@ohos.base'; ``` ## systemparameter.getSync @@ -41,7 +42,7 @@ getSync(key: string, def?: string): string ```ts try { - var info = systemparameter.getSync("const.ohos.apiversion"); + let info = systemparameter.getSync("const.ohos.apiversion"); console.log(JSON.stringify(info)); } catch(e) { console.log("getSync unexpected error: " + e); @@ -67,7 +68,7 @@ get(key: string, callback: AsyncCallback<string>): void ```ts try { - systemparameter.get("const.ohos.apiversion", function (err, data) { + systemparameter.get("const.ohos.apiversion", (err:BusinessError, data:string) => { if (err == undefined) { console.log("get test.parameter.key value success:" + data) } else { @@ -98,7 +99,7 @@ get(key: string, def: string, callback: AsyncCallback<string>): void ```ts try { - systemparameter.get("const.ohos.apiversion", "default", function (err, data) { + systemparameter.get("const.ohos.apiversion", "default", (err:BusinessError, data:string) => { if (err == undefined) { console.log("get test.parameter.key value success:" + data) } else { @@ -135,10 +136,10 @@ get(key: string, def?: string): Promise<string> ```ts try { - var p = systemparameter.get("const.ohos.apiversion"); - p.then(function (value) { + let p = systemparameter.get("const.ohos.apiversion"); + p.then((value:string) => { console.log("get test.parameter.key success: " + value); - }).catch(function (err) { + }).catch((err:BusinessError) => { console.log("get test.parameter.key error: " + err.code); }); } catch(e) { @@ -191,7 +192,7 @@ set(key: string, value: string, callback: AsyncCallback<void>): void ```ts try { - systemparameter.set("test.parameter.key", "testValue", function (err, data) { + systemparameter.set("test.parameter.key", "testValue", (err:BusinessError, data:string) => { if (err == undefined) { console.log("set test.parameter.key value success :" + data) } else { @@ -227,10 +228,10 @@ set(key: string, value: string): Promise<void> ```ts try { - var p = systemparameter.set("test.parameter.key", "testValue"); - p.then(function (value) { + let p = systemparameter.set("test.parameter.key", "testValue"); + p.then((value:string) => { console.log("set test.parameter.key success: " + value); - }).catch(function (err) { + }).catch((err:BusinessError) => { console.log(" set test.parameter.key error: " + err.code); }); } catch(e) { -- GitLab