Skip to content

Type Alias: CopyRx_Transform<TIn, TOut, ThisArg>

CopyRx_Transform<TIn, TOut, ThisArg> = (this, newValue, output) => ValueOrPromise<TOut> | typeof IGNORE_UPDATE_SYMBOL

Defined in: packages/rx/src/copyRx.ts:73

Value modifier function definition for copyRx.

This function is executed for each new value emitted by the input observable(s).

  • this context: The this context within the transform function can be set using the options.thisArg
  • Ignoring updates: Returning copyRx.IGNORE will prevent the output observable from emitting the current update.
  • Asynchronous transformations: If a Promise is returned, the output observable will only be updated once the promise resolves. However, this can introduce race conditions if new input values arrive before the previous promise resolves. To prevent such race conditions, enable the transformSequentially flag in CopyRx_Options.
  • Error handling: If the transform function throws an error, the update is gracefully ignored, and the onError callback (if provided in CopyRx_Options) will be invoked.

Type Parameters

TIn

TIn = unknown

TOut

TOut = TIn

ThisArg

ThisArg = unknown

Parameters

this

ThisArg

newValue

TIn

output

Observable<TOut>

Returns

ValueOrPromise<TOut> | typeof IGNORE_UPDATE_SYMBOL