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 813277d8d46ad7f24e20b6e87a5abf3eda0c41ce..f6b9c5573d65e91d54823b2beaec10a224320c3f 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) @@ -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,8 +137,8 @@ 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) { console.log("get test.parameter.key error: " + err.code); @@ -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,8 +242,8 @@ 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) { console.log(" set test.parameter.key error: " + err.code); 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 deb3aa478fd82c340b70cc088dda988e38ef1075..90179035677d83299ff23f79916a5f05e1bf265b 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 @@ -67,7 +68,11 @@ get(key: string, callback: AsyncCallback<string>): void ```ts try { +<<<<<<< HEAD + systemparameter.get("const.ohos.apiversion", (err : BusinessError, data : String) => { +======= systemparameter.get("const.ohos.apiversion", function (err, data) { +>>>>>>> parent of 6e2bed2e97 (Update) if (err == undefined) { console.log("get test.parameter.key value success:" + data) } else { @@ -98,7 +103,11 @@ get(key: string, def: string, callback: AsyncCallback<string>): void ```ts try { +<<<<<<< HEAD + systemparameter.get("const.ohos.apiversion", "default", (err:BusinessError, data:String) => { +======= systemparameter.get("const.ohos.apiversion", "default", function (err, data) { +>>>>>>> parent of 6e2bed2e97 (Update) if (err == undefined) { console.log("get test.parameter.key value success:" + data) } else { @@ -135,8 +144,13 @@ get(key: string, def?: string): Promise<string> ```ts try { +<<<<<<< HEAD + let p = systemparameter.get("const.ohos.apiversion"); + p.then((value:String) => { +======= var p = systemparameter.get("const.ohos.apiversion"); p.then(function (value) { +>>>>>>> parent of 6e2bed2e97 (Update) console.log("get test.parameter.key success: " + value); }).catch(function (err) { console.log("get test.parameter.key error: " + err.code); @@ -191,7 +205,11 @@ set(key: string, value: string, callback: AsyncCallback<void>): void ```ts try { +<<<<<<< HEAD + systemparameter.set("test.parameter.key", "testValue", (err:BusinessError, data:String) => { +======= systemparameter.set("test.parameter.key", "testValue", function (err, data) { +>>>>>>> parent of 6e2bed2e97 (Update) if (err == undefined) { console.log("set test.parameter.key value success :" + data) } else { @@ -227,8 +245,13 @@ set(key: string, value: string): Promise<void> ```ts try { +<<<<<<< HEAD + let p = systemparameter.set("test.parameter.key", "testValue"); + p.then((value:String) => { +======= var p = systemparameter.set("test.parameter.key", "testValue"); p.then(function (value) { +>>>>>>> parent of 6e2bed2e97 (Update) console.log("set test.parameter.key success: " + value); }).catch(function (err) { console.log(" set test.parameter.key error: " + err.code);