From cc97812a6b53fd2dece74558ba8d82ddcd7af398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 11 Jan 2023 11:32:41 +0100 Subject: [PATCH] update JSDocs --- .../data-types/workspace/workspace-data-type.context.ts | 1 - .../src/core/observable-api/unique-behavior-subject.ts | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/workspace-data-type.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/workspace-data-type.context.ts index 6a58101d9c..32ec3aa1a5 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/workspace-data-type.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/workspace-data-type.context.ts @@ -30,7 +30,6 @@ export class UmbWorkspaceDataTypeContext extends UmbWorkspaceContentContext< const entry = {alias: alias, value: value}; - // TODO: Can we move this into a method of its own? const newDataSet = appendToFrozenArray((this._data.getValue() as DataTypeDetails).data, entry, x => x.alias === alias); this.update({data: newDataSet}); diff --git a/src/Umbraco.Web.UI.Client/src/core/observable-api/unique-behavior-subject.ts b/src/Umbraco.Web.UI.Client/src/core/observable-api/unique-behavior-subject.ts index 561d112266..2d6fd318ba 100644 --- a/src/Umbraco.Web.UI.Client/src/core/observable-api/unique-behavior-subject.ts +++ b/src/Umbraco.Web.UI.Client/src/core/observable-api/unique-behavior-subject.ts @@ -30,13 +30,15 @@ export function naiveObjectComparison(objOne: any, objTwo: any): boolean { /** * @export - * @method CreateObservablePart + * @method appendToFrozenArray * @param {Observable} source - RxJS Subject to use for this Observable. * @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return. * @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different. * @description - Creates a RxJS Observable from RxJS Subject. - * @example Example create a Observable for part of the data Subject. - * public readonly myPart = CreateObservablePart(this._data, (data) => data.myPart); + * @example Example append new entry for a UniqueBehaviorSubject which is an array. Where the key is unique and the item will be updated if matched with existing. + * const entry = {key: 'myKey', value: 'myValue'}; + * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.key === key); + * mySubject.next(newDataSet); */ export function appendToFrozenArray(data: T[], entry: T, uniqueMethod?: (entry: T) => boolean): T[] { const unFrozenDataSet = [...data];