• Preparing search index...
  • The search index is not available
@umbraco-cms/backoffice
  • @umbraco-cms/backoffice
  • libs/observable-api
  • mergeObservables

Function mergeObservables

  • mergeObservables<
        R,
        SourceTypes extends Observable<unknown>[],
        SourceTypeArray = ArrayToObservableTypes<SourceTypes>,
    >(
        sources: [...SourceTypes[]],
        mergeFunction: MappingFunction<SourceTypeArray, R>,
        memoizationFunction?: MemoizationFunction<R>,
    ): Observable<R>

    Type Parameters

    • R
    • SourceTypes extends Observable<unknown>[]
    • SourceTypeArray = ArrayToObservableTypes<SourceTypes>

    Parameters

    • sources: [...SourceTypes[]]

      an Array of Observables to merge for this Observable.

    • mergeFunction: MappingFunction<SourceTypeArray, R>

      Merge method to return the part for this Observable to return.

    • OptionalmemoizationFunction: MemoizationFunction<R>

      Method to Compare if the merged data has changed. Should return true when data is different.

    Returns Observable<R>

    • Returns a new Observable that combines the Observables into a single Observable.

    Function

    mergeObservables

    Description

    • Creates a Observable from two or more Observables.

    Example

    const mergedObservable = mergeObservables(
    [observable1, observable2],
    ([value1, value2]) => value1 + value2,
    );

    if observable1 has the value of 10 and observable2 has the value of 4, the mergedObservable will return the value of 14.
    if one of them changes the mergedObservable will return the new value.
    • Defined in src/libs/observable-api/utils/merge-observables.function.ts:28

Settings

Member Visibility
@umbraco-cms/backoffice
  • Loading...

Generated using TypeDoc