Getting Started
Writing content
API Documentation
Customization
Recipes
API References Develop
@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

A string that identifies the builder.

builders
readonly ObservableInput<BuilderState<T>>[]

An array of Observables of BuilderState.

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

A function that takes the results of the successful Observables and returns a Promise.

cacheStrategy
CacheStrategy<TCacheData, R> | undefined

An optional CacheStrategy object.