API Reference

rsx function

rsx takes an expression string and returns a binder function. Call the binder with a model to get an executable expression instance.

Description

rsx('a + b')returns a function that binds the expression to your model. Only the model parts used by the expression become reactive. For example, with rsx('a + b'), fields a and b are tracked, while an unrelated field like c is not.

Parameters

expressionStringstring

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

modelTModel extends object

Target object context bound to the expression.

leafIndexWatchRule?IIndexWatchRule

Optional rule controlling how leaf index dependencies are watched.

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.