Overview
Index-watch-rule contracts, registry, and default recursive/non-recursive watch rules.
API Reference
Default factory used by the runtime to create watch rules for identifier/index based observation. Created rules are stable per (context, index) and can be disposed when no longer needed.
import { IndexWatchRuleFactory } from '@rs-x/state-manager';import { IndexWatchRuleFactory } from '@rs-x/state-manager';
const factory = new IndexWatchRuleFactory();
const rule = factory.create({ user: { profile: {} } }, 'user');
// rule can be passed to watchState(..., { indexWatchRule: rule })
// or rsx(...)(model, rule)
rule.dispose();import { Inject } from '@rs-x/core';
import {
RsXStateManagerInjectionTokens,
type IIndexWatchRuleFactory,
} from '@rs-x/state-manager';
class MyConsumer {
constructor(
@Inject(RsXStateManagerInjectionTokens.IIndexWatchRuleFactory)
private readonly dependency: IIndexWatchRuleFactory,
) {}
}2 members in this class.
constructor()Parameters
No parameters.
public create(
context: unknown,
index: unknown
): IIndexWatchRuleParameters
| Name | Type | Required |
|---|---|---|
| context | unknown | required |
| index | unknown | required |
Returns