API Reference

rsx function

rsx takes an expression string (and optional declaration options) and returns a binder function. Then call that binder with a model to create a bound expression.

Description

Call shape: rsx(expression, options?)(model, leafIndexWatchRule?).

Step 1: rsx('a + b', options?) declares the expression and returns a binder.

Step 2: calling that binder with (model) creates the live expression instance.

For a + b, fields a and b are tracked; unrelated fields are not.

Parameters

expressionStringstring

Expression string to parse (for example 'a + b').

modelTModel extends object

Target object context bound to the expression.

options?IRsxOptions

Optional per-expression options object: { preparse?: boolean; lazy?: boolean; compiled?: boolean }.

leafIndexWatchRule?IIndexWatchRule

Optional rule controlling how leaf index dependencies are watched.

Arguments and options explained

model and leafIndexWatchRule are binder arguments: (model, leafIndexWatchRule?).

model is required and defines binding context for identifier resolution.

leafIndexWatchRule is optional and lets you customize leaf/member watch behavior for arrays/maps/ sets or nested object paths.

preparse and lazy plus compiled are declaration options on the rsx(..., options) call used by compiler/AOT workflows. Defaults: preparse=true, lazy=false, compiled=true.

See IRsxOptions for option details.

Return type

Returns a binder function: (model, leafIndexWatchRule?) => IExpression<TReturn>

Requirements

Load RsXExpressionParserModule into the InjectionContainer before using rsx.

Usage notes

You can also resolve the singleton IExpressionFactory from the InjectionContainer and call create(...) directly. That works, but rsx(...) is the simplest entry point and avoids extra DI boilerplate in application code.

If you want the full step-by-step lifecycle (create, bind, options, subscribe, dispose), see Create your first expression.