From a0b710b003ef42c512ccab70a13596caf385651e Mon Sep 17 00:00:00 2001 From: hanlu Date: Tue, 11 Jan 2022 16:47:17 +0800 Subject: [PATCH 1/6] objectstore js d.ts Signed-off-by: hanlu --- api/@ohos.data.distributedDataObject.d.ts | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 api/@ohos.data.distributedDataObject.d.ts diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts new file mode 100644 index 0000000000..faff82a684 --- /dev/null +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import { AsyncCallback, Callback } from './basic'; + +/** + * Provides interfaces to obtain and modify storage data. + * + * @name distributeddataobject + * @since 8 + * @sysCap + * @devices phone, tablet + */ +declare namespace distributedDataObject { + function distributed(obj: object): DistributedObject; + function genSessionId(): String; + + interface DistributedObject { + setSession(sessionId?: String): void; + on(type: 'change', callback: Callback): void; + off(type: 'change', callback?: Callback): void; + } + interface ChangedDataObserver { + sessionId: string; + changeData: Array; + } +} + +export default distributedDataObject; \ No newline at end of file -- Gitee From 457764eca8a408fbcac3ebf4ea70fa2e73aa2d10 Mon Sep 17 00:00:00 2001 From: hanlu Date: Wed, 12 Jan 2022 11:16:03 +0800 Subject: [PATCH 2/6] objectstore Signed-off-by: hanlu --- api/@ohos.data.distributedDataObject.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index faff82a684..d44c275410 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,10 +15,10 @@ import { AsyncCallback, Callback } from './basic'; /** - * Provides interfaces to obtain and modify storage data. + * Provides interfaces to sync distributed object * - * @name distributeddataobject - * @since 8 + * @name distributedDataObject + * @since * @sysCap * @devices phone, tablet */ -- Gitee From 2ba53ebbbb5503049fe7cbd7a0bf0748a26c7601 Mon Sep 17 00:00:00 2001 From: hanlu Date: Sun, 16 Jan 2022 13:46:56 +0800 Subject: [PATCH 3/6] objectstore Signed-off-by: hanlu --- api/@ohos.data.distributedDataObject.d.ts | 56 +++++++++++++++++++---- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index d44c275410..4b14b4c01e 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -18,22 +18,58 @@ import { AsyncCallback, Callback } from './basic'; * Provides interfaces to sync distributed object * * @name distributedDataObject - * @since + * @since 8 * @sysCap - * @devices phone, tablet + * @devices phone */ declare namespace distributedDataObject { + /** + * create distributed data + * + * @param obj init data of distributed data + * @return Returns the distributed object + * @since 8 + */ function distributed(obj: object): DistributedObject; - function genSessionId(): String; + /** + * generate a random sessionId + * + * @return Returns the random sessionId + * @since 8 + */ + function genSessionId(): string; + + /** + * object create by {@link distributed}. + * + * @Syscap SystemCapability.Data.DATA_DISTRIBUTEDDATAMGR + * @devices phone + * @since 8 + */ interface DistributedObject { - setSession(sessionId?: String): void; - on(type: 'change', callback: Callback): void; - off(type: 'change', callback?: Callback): void; - } - interface ChangedDataObserver { - sessionId: string; - changeData: Array; + /** + * change object session + * + * @param sessionId the sessionId to be joined, if empty, leave all session + * @return operation result, true is success + * @since 8 + */ + setSession(sessionId?: string): boolean; + /** + * on watch of change + * + * @param callback the callback of change + * @since 8 + */ + on(type: 'change', callback: Callback<{ sessionId: string, fields: Array }>): void; + /** + * off watch of change + * + * @param callback if not null, off the callback, if undefined, off all callbacks + * @since 8 + */ + off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array }>): void; } } -- Gitee From bfcdc22d748033bdfce0052bceff6175de5a2420 Mon Sep 17 00:00:00 2001 From: hanlu Date: Mon, 17 Jan 2022 09:29:27 +0000 Subject: [PATCH 4/6] update api/@ohos.data.distributedDataObject.d.ts. --- api/@ohos.data.distributedDataObject.d.ts | 42 ++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index 4b14b4c01e..b2d6ede8dd 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; +import {AsyncCallback, Callback} from './basic'; /** * Provides interfaces to sync distributed object @@ -24,7 +24,7 @@ import { AsyncCallback, Callback } from './basic'; */ declare namespace distributedDataObject { /** - * create distributed data + * Create distributed data * * @param obj init data of distributed data * @return Returns the distributed object @@ -33,7 +33,7 @@ declare namespace distributedDataObject { function distributed(obj: object): DistributedObject; /** - * generate a random sessionId + * Generate a random sessionId * * @return Returns the random sessionId * @since 8 @@ -41,7 +41,7 @@ declare namespace distributedDataObject { function genSessionId(): string; /** - * object create by {@link distributed}. + * Object create by {@link distributed}. * * @Syscap SystemCapability.Data.DATA_DISTRIBUTEDDATAMGR * @devices phone @@ -49,26 +49,28 @@ declare namespace distributedDataObject { */ interface DistributedObject { /** - * change object session - * - * @param sessionId the sessionId to be joined, if empty, leave all session - * @return operation result, true is success - * @since 8 - */ + * Change object session + * + * @param sessionId the sessionId to be joined, if empty, leave all session + * @return operation result, true is success + * @since 8 + */ setSession(sessionId?: string): boolean; + /** - * on watch of change - * - * @param callback the callback of change - * @since 8 - */ + * On watch of change + * + * @param callback the callback of change + * @since 8 + */ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array }>): void; + /** - * off watch of change - * - * @param callback if not null, off the callback, if undefined, off all callbacks - * @since 8 - */ + * Off watch of change + * + * @param callback if not null, off the callback, if undefined, off all callbacks + * @since 8 + */ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array }>): void; } } -- Gitee From b3a01c8e4fef123f0bff06e1b809177c61e859ed Mon Sep 17 00:00:00 2001 From: hanlu Date: Mon, 17 Jan 2022 09:34:54 +0000 Subject: [PATCH 5/6] update api/@ohos.data.distributedDataObject.d.ts. Signed-off-by: hanlu --- api/@ohos.data.distributedDataObject.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index b2d6ede8dd..a0b223ea3c 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -26,7 +26,7 @@ declare namespace distributedDataObject { /** * Create distributed data * - * @param obj init data of distributed data + * @param obj Init data of distributed data * @return Returns the distributed object * @since 8 */ @@ -51,8 +51,8 @@ declare namespace distributedDataObject { /** * Change object session * - * @param sessionId the sessionId to be joined, if empty, leave all session - * @return operation result, true is success + * @param sessionId The sessionId to be joined, if empty, leave all session + * @return Operation result, true is success * @since 8 */ setSession(sessionId?: string): boolean; @@ -60,7 +60,7 @@ declare namespace distributedDataObject { /** * On watch of change * - * @param callback the callback of change + * @param callback The callback of change * @since 8 */ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array }>): void; @@ -68,7 +68,7 @@ declare namespace distributedDataObject { /** * Off watch of change * - * @param callback if not null, off the callback, if undefined, off all callbacks + * @param callback If not null, off the callback, if undefined, off all callbacks * @since 8 */ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array }>): void; -- Gitee From 20b1b7e8c04da70803df90ccd374919433785070 Mon Sep 17 00:00:00 2001 From: hanlu Date: Mon, 17 Jan 2022 17:40:24 +0800 Subject: [PATCH 6/6] objectstore Signed-off-by: hanlu --- api/@ohos.data.distributedDataObject.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index a0b223ea3c..5f0fadb773 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -52,7 +52,7 @@ declare namespace distributedDataObject { * Change object session * * @param sessionId The sessionId to be joined, if empty, leave all session - * @return Operation result, true is success + * @return Operation result, true is success, false is failed * @since 8 */ setSession(sessionId?: string): boolean; @@ -75,4 +75,4 @@ declare namespace distributedDataObject { } } -export default distributedDataObject; \ No newline at end of file +export default distributedDataObject; -- Gitee