From 9063eb046172ce5980332ce649d0429012fbf7a1 Mon Sep 17 00:00:00 2001 From: xujie Date: Tue, 1 Aug 2023 17:14:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Promise=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xujie --- .../reference/apis/js-apis-net-policy.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md index 48ac1c115d..8050e30468 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md @@ -89,7 +89,7 @@ setBackgroundAllowed(isAllowed: boolean): Promise\ **示例:** ```js -policy.setBackgroundAllowed(true).then(function (error) { +policy.setBackgroundAllowed(true).then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -164,7 +164,7 @@ isBackgroundAllowed(): Promise\; **示例:** ```js -policy.isBackgroundAllowed().then(function (error, data) { +policy.isBackgroundAllowed().then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -248,7 +248,7 @@ setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\; **示例:** ```js -policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(function (error) { +policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -329,7 +329,7 @@ getPolicyByUid(uid: number): Promise\; **示例:** ```js -policy.getPolicyByUid(11111).then(function (error, data) { +policy.getPolicyByUid(11111).then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -412,7 +412,7 @@ getUidsByPolicy(policy: NetUidPolicy): Promise\>; **示例:** ```js -policy.getUidsByPolicy(11111).then(function (error, data) { +policy.getUidsByPolicy(11111).then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -487,7 +487,7 @@ getNetQuotaPolicies(): Promise\>; **示例:** ```js -policy.getNetQuotaPolicies().then(function (error, data) { +policy.getNetQuotaPolicies().then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -608,7 +608,7 @@ let netquotapolicy = { netQuotaPolicyList.push(netquotapolicy); -policy.setNetQuotaPolicies(netQuotaPolicyList).then(function (error) { +policy.setNetQuotaPolicies(netQuotaPolicyList).then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -692,7 +692,7 @@ isUidNetAllowed(uid: number, isMetered: boolean): Promise\; **示例:** ```js -policy.isUidNetAllowed(11111, true).then(function (error, data) { +policy.isUidNetAllowed(11111, true).then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -777,7 +777,7 @@ isUidNetAllowed(uid: number, iface: string): Promise\; **示例:** ```js -policy.isUidNetAllowed(11111, 'wlan0').then(function (error, data) { +policy.isUidNetAllowed(11111, 'wlan0').then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -861,7 +861,7 @@ setDeviceIdleTrustlist(uids: Array\, isAllowed: boolean): Promise\ **示例:** ```js -policy.setDeviceIdleTrustlist([11111,22222], true).then(function (error) { +policy.setDeviceIdleTrustlist([11111,22222], true).then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -934,7 +934,7 @@ getDeviceIdleTrustlist(): Promise\>; **示例:** ```js -policy.getDeviceIdleTrustlist().then(function (error, data) { +policy.getDeviceIdleTrustlist().then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -1017,7 +1017,7 @@ getBackgroundPolicyByUid(uid: number): Promise\; **示例:** ```js -policy.getBackgroundPolicyByUid(11111).then(function (error, data) { +policy.getBackgroundPolicyByUid(11111).then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) @@ -1099,7 +1099,7 @@ resetPolicies(simId: string): Promise\; **示例:** ```js -policy.resetPolicies('1').then(function (error) { +policy.resetPolicies('1').then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -1186,7 +1186,7 @@ updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType): ```js import connection from '@ohos.net.connection'; -policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(function (error) { +policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -1269,7 +1269,7 @@ setPowerSaveTrustlist(uids: Array\, isAllowed: boolean): Promise\; **示例:** ```js -policy.setPowerSaveTrustlist([11111,22222], true).then(function (error) { +policy.setPowerSaveTrustlist([11111,22222], true).then((error) => { console.log(JSON.stringify(error)) }) ``` @@ -1343,7 +1343,7 @@ getPowerSaveTrustlist(): Promise\>; **示例:** ```js -policy.getPowerSaveTrustlist().then(function (error, data) { +policy.getPowerSaveTrustlist().then((error, data) => { console.log(JSON.stringify(error)) console.log(JSON.stringify(data)) }) -- GitLab