From 52ad0174f9dc872e9c3702b2fca4141cc8dd16de Mon Sep 17 00:00:00 2001 From: liuliu Date: Fri, 1 Sep 2023 09:49:30 +0800 Subject: [PATCH] fixed 3342c3f from https://gitee.com/liuliu_0/docs/pulls/23653 arkts code linter fix Signed-off-by: liuliu Change-Id: Ia5aba989524f8c6e898691eb98a32b902fdc813d --- .../apis/js-apis-app-ability-dialogRequest.md | 2 +- .../apis/js-apis-uripermissionmanager.md | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md index 9d23dacec6..8c9ae7e940 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md @@ -10,7 +10,7 @@ dialogRequest模块用于处理模态弹框的能力,包括获取RequestInfo ## 导入模块 -```js +```ts import dialogRequest from '@ohos.app.ability.dialogRequest'; ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md b/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md index afe36344f8..ba222702dd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md @@ -10,7 +10,7 @@ URI权限管理模块。用于应用A授权/撤销授权URI给应用B ## 导入模块 -```js +```ts import uriPermissionManager from '@ohos.application.uriPermissionManager'; ``` @@ -33,7 +33,7 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | uri | string | 是 | 指向文件的URI,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 | - | flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | 是 | URI的读权限或写权限。 | + | flag | [wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags) | 是 | URI的读权限或写权限。 | | targetBundleName | string | 是 | 被授权URI的应用包名 | | callback | AsyncCallback<number> | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 | @@ -50,15 +50,15 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri **示例:** - ```js + ```ts import uriPermissionManager from '@ohos.application.uriPermissionManager'; - import WantConstant from '@ohos.ability.wantConstant'; + import WantConstant from '@ohos.app.ability.wantConstant'; import fs from '@ohos.file.fs'; import fileUri from '@ohos.file.fileuri'; let targetBundleName = 'com.example.test_case1' let path = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir"; - fs.mkdir(path, function (err) { + fs.mkdir(path, (err) => { if (err) { console.log("mkdir error"+err.message) } else { @@ -90,7 +90,7 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | uri | string | 是 | 指向文件的URI,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 | - | flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | 是 | URI的读权限或写权限。 | + | flag | [wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags) | 是 | URI的读权限或写权限。 | | targetBundleName | string | 是 | 被授权URI的应用包名 | **返回值:** @@ -112,16 +112,17 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri **示例:** - ```js + ```ts import uriPermissionManager from '@ohos.application.uriPermissionManager'; - import WantConstant from '@ohos.ability.wantConstant'; + import WantConstant from '@ohos.app.ability.wantConstant'; import fs from '@ohos.file.fs'; import fileUri from '@ohos.file.fileuri'; + import { BusinessError } from '@ohos.base'; let targetBundleName = 'com.example.test_case1' let path = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir"; - fs.mkdir(path, function (err) { + fs.mkdir(path, (err) => { if (err) { console.log("mkdir error"+err.message) } else { @@ -132,7 +133,7 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri uriPermissionManager.grantUriPermission(uri, WantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName) .then((data) => { console.log('Verification succeeded.' + data) - }).catch((error) => { + }).catch((error: BusinessError) => { console.log('Verification failed.'); }) ``` @@ -168,10 +169,9 @@ revokeUriPermission(uri: string, targetBundleName: string, callback: AsyncCallba **示例:** - ```js + ```ts import uriPermissionManager from '@ohos.application.uriPermissionManager'; - import WantConstant from '@ohos.ability.wantConstant'; - + let targetBundleName = 'com.example.test_case2' let uri = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir" uriPermissionManager.revokeUriPermission(uri, targetBundleName, (result) => { @@ -219,16 +219,16 @@ revokeUriPermission(uri: string, targetBundleName: string): Promise<number> **示例:** - ```js + ```ts import uriPermissionManager from '@ohos.application.uriPermissionManager'; - import WantConstant from '@ohos.ability.wantConstant'; + import { BusinessError } from '@ohos.base'; let targetBundleName = 'com.example.test_case2' let uri = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir" uriPermissionManager.revokeUriPermission(uri, targetBundleName) .then((data) => { console.log('Verification succeeded.' + data) - }).catch((error) => { + }).catch((error: BusinessError) => { console.log('Verification failed.'); }) ``` -- GitLab