diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 2fd26a2db400bc298d6202acf322afe7fe933ec2..6ace478beee76bedfa121584272eff9a3f23eeac 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1188,6 +1188,18 @@ declare namespace distributedData { */ off(event:'dataChange', observer?: Callback): void; + /** + * UnRegister Synchronizes {@code KvStore} database callback. + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** * Inserts key-value pairs into the {@code KvStore} database in batches. * @@ -1417,6 +1429,20 @@ declare namespace distributedData { */ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param observer Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + on(event: 'dataChange', type: SubscribeType, observer: Callback): void; + /** * Register Synchronizes SingleKvStore databases callback. * @@ -1429,6 +1455,19 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param observer Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + off(event:'dataChange', observer?: Callback): void; + /** * UnRegister Synchronizes SingleKvStore databases callback. * @note N/A @@ -1438,7 +1477,6 @@ declare namespace distributedData { */ off(event: 'syncComplete', syncCallback?: Callback>): void; - /** * Sets the default delay allowed for database synchronization * @@ -1665,6 +1703,34 @@ declare namespace distributedData { * @throws Throws this exception if no DeviceKVStore database is available. */ on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param observer Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + on(event: 'dataChange', type: SubscribeType, observer: Callback): void; + + /** + * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param observer Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + off(event:'dataChange', observer?: Callback): void; /** * UnRegister Synchronizes DeviceKVStore databases callback.