From acd93659ca7dfb1d6bf3369cc1ed4ea6f0df010e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=9B=E4=BA=9A=E8=8A=B3?= Date: Wed, 27 Apr 2022 09:45:35 +0000 Subject: [PATCH] update en/application-dev/database/database-mdds-guidelines.md. Signed-off-by: @ge-yafang --- .../database/database-mdds-guidelines.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/en/application-dev/database/database-mdds-guidelines.md b/en/application-dev/database/database-mdds-guidelines.md index d0be8af0aa..b335953d1a 100644 --- a/en/application-dev/database/database-mdds-guidelines.md +++ b/en/application-dev/database/database-mdds-guidelines.md @@ -77,7 +77,7 @@ The following uses a single KV store as an example to describe the development p 1. Import the distributed database module. - ``` + ```js import distributedData from '@ohos.data.distributedData'; ``` @@ -88,7 +88,7 @@ The following uses a single KV store as an example to describe the development p The sample code is as follows: - ``` + ```js let kvManager; try { const kvManagerConfig = { @@ -118,7 +118,7 @@ The following uses a single KV store as an example to describe the development p The sample code is as follows: - ``` + ```js let kvStore; try { const options = { @@ -149,7 +149,7 @@ The following uses a single KV store as an example to describe the development p The following is the sample code for subscribing to the data changes of a single KV store: - ``` + ```js kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) { console.log("dataChange callback call data: " + JSON.stringify(data)); }); @@ -162,7 +162,7 @@ The following uses a single KV store as an example to describe the development p The following is the sample code for writing key-value pairs of the string type into the single KV store: - ``` + ```js const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { @@ -185,7 +185,7 @@ The following uses a single KV store as an example to describe the development p The following is the sample code for querying data of the string type from the single KV store: - ``` + ```js const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { @@ -210,7 +210,7 @@ The following uses a single KV store as an example to describe the development p The following is the sample code for data synchronization in a single KV store. **deviceIds** can be obtained by deviceManager by calling **getTrustedDeviceListSync\(\)**, and **1000** indicates that the maximum delay time is 1000 ms. - ``` + ```js import deviceManager from '@ohos.distributedHardware.deviceManager'; let devManager; @@ -231,5 +231,3 @@ The following uses a single KV store as an example to describe the development p } kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000); ``` - - -- GitLab