diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index aa7f594fc77087b04158be84b0abe8268898d279..b1f2b24c1e70f3ebb0626134c9f148cc46eafa4e 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -72,6 +72,26 @@ declare namespace distributedDataObject { * @since 8 */ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array }>): void; + + /** + * On watch of status + * + * @param callback Indicates the observer of object status changed. + * sessionId: The sessionId of the changed object + * networkId: NetworkId of the changed device + * status: 'online' The object became online on the device and data can be synced to the device + * 'offline' The object became offline on the device and the object can not sync any data + * @since 8 + */ + on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void; + + /** + * Off watch of status + * + * @param callback If not null, off the callback, if undefined, off all callbacks + * @since 8 + */ + off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, status: 'online' | 'offline' }>): void; } }