@ng-doc/builder / Function

factory

Generic types:T R TCacheData

The factory function is a powerful tool for creating complex builders. It should be used when you need to build something based on the results of multiple other builders.

Presentation

function factory(
  tag: string,
  builders: readonly ObservableInput<BuilderState<T>>[],
  buildFn: (...args: T[]) => R | Promise<R>,
  cacheStrategy?: CacheStrategy<TCacheData, R> | undefined,
): Builder<R>;

Returns

Builder<R> -

An Observable of BuilderState.

Parameters

NameTypeDescription
tag
string

@param tag - A string that identifies the builder.

builders
readonly ObservableInput<BuilderState<T>>[]

@param builders - An array of Observables of BuilderState.

buildFn
(...args: T[]) => R | Promise<R>

@param buildFn - A function that takes the results of the successful Observables and returns a Promise.

cacheStrategy
CacheStrategy<TCacheData, R> | undefined

@param cacheStrategy - An optional CacheStrategy object.