diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md
index 8eac658728dd5ebf6261a9ed8526762d3db71cba..9108469149f87ad75973ac02caab20f5ce975cee 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md
@@ -199,7 +199,7 @@ try {
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| key | string | 是 | 指定发布数据的键。 |
-| data | string \| [Ashmem](js-apis-rpc.md#ashmem8) | 是 | 指定发布的数据。如果数据很大,请使用Ashmem。 |
+| data | string \| ArrayBuffer | 是 | 指定发布的数据。如果发布数据大小超过20KB,建议使用ArrayBuffer。 |
| subscriberId | string | 是 | 指定订阅者id。 |
## RdbDataChangeNode10+
@@ -478,18 +478,15 @@ on(type: 'publishedDataChange', uris: Array<string>, subscriberId: string,
**示例:**
```ts
-import rpc from '@ohos.rpc';
-
function onPublishCallback(err, node:dataShare.PublishedDataChangeNode) {
console.info("onPublishCallback node bundleName " + JSON.stringify(node.bundleName));
console.info("onPublishCallback node data size" + node.data.length);
for (let i = 0; i < node.data.length; i++) {
console.info("onPublishCallback node " + typeof node.data[i].data);
if (typeof node.data[i].data != 'string') {
- let ash:rpc.Ashmem = node.data[i].data;
- ash.mapReadonlyAshmem();
- console.info("onPublishCallback " + JSON.stringify(ash.readAshmem(ash.getAshmemSize()/4, 0)));
- ash.closeAshmem();
+ let array:ArrayBuffer = node.data[i].data;
+ let data:Uint8Array = new Uint8Array(array);
+ console.info("onPublishCallback " + i + " " + JSON.stringify(data));
}
console.info("onPublishCallback data " + i + " " + JSON.stringify(node.data[i]));
}
@@ -561,29 +558,13 @@ publish(data: Array<PublishedItem>, bundleName: string, version: number, c
**示例:**
```ts
-import rpc from '@ohos.rpc';
-
-let ashmem = null;
-let subscriberId = '11';
+let arrayBuffer = new ArrayBuffer(1);
let version = 1;
-let data : Array = [
- {key:"city", subscriberId:"11", data:"xian"},
- {key:"datashareproxy://com.acts.ohos.data.datasharetest/appInfo", subscriberId:"11", data:"appinfo is just a test app"},
- {key:"empty", subscriberId:"11", data:"nobody sub"}];
-let nums:number[] = [1,2,3];
+let data : Array = [{key:"key2", subscriberId:"11", data:arrayBuffer}];
function publishCallback(err, result: Array) {
console.info("publishCallback " + JSON.stringify(result));
- ashmem.closeAshmem();
}
try {
- ashmem = rpc.Ashmem.create("ashmem", (nums.length) * 4);
- ashmem.mapReadWriteAshmem();
- ashmem.writeAshmem(nums, nums.length, 0);
- data.push({
- "key" : "key2",
- "data" : ashmem,
- "subscriberId" : "11",
- });
console.info("data length is:", data.length);
dataShareHelper.publish(data, "com.acts.ohos.data.datasharetest", version, publishCallback);
} catch (e) {
diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-datashare.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-datashare.md
new file mode 100644
index 0000000000000000000000000000000000000000..64a399d30f428d342fadf30bedf3955282c42466
--- /dev/null
+++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-datashare.md
@@ -0,0 +1,39 @@
+# 分布式数据管理子系统ChangeLog
+
+## cl.datashare.1 js-apis-data-dataShare API version 10开始托管数据PublishedItem中data的数据类型从Ashmem变更为ArrayBuffer
+
+**变更影响**
+
+PublishedItem中data的数据类型从Ashmem变更为ArrayBuffer
+
+## PublishedItem10+
+
+指定发布的数据类型。
+
+**系统能力:** SystemCapability.DistributedDataManager.DataShare.Consumer
+
+| 名称 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| key | string | 是 | 指定发布数据的键。 |
+| data | string \| ArrayBuffer | 是 | 指定发布的数据。如果数据很大,请使用ArrayBuffer。 |
+| subscriberId | string | 是 | 指定订阅者id。 |
+
+**适配指导**
+示例代码如下:
+
+**示例:**
+
+```ts
+let arrayBuffer = new ArrayBuffer(1);
+let version = 1;
+let data : Array = [{key:"key2", subscriberId:"11", data:arrayBuffer}];
+function publishCallback(err, result: Array) {
+ console.info("publishCallback " + JSON.stringify(result));
+}
+try {
+ console.info("data length is:", data.length);
+ dataShareHelper.publish(data, "com.acts.ohos.data.datasharetest", version, publishCallback);
+} catch (e) {
+ console.error("publish error " + JSON.stringify(e));
+}
+```
\ No newline at end of file