When to use
Base class: KeyedInstanceFactory<IISequenceWithIdData, IFunctionCallIndexData, IDisposableFunctionCallIndex>.
API Reference
Factory service that creates and reuses function-call index objects from context, function name, and arguments.
Base class: KeyedInstanceFactory<IISequenceWithIdData, IFunctionCallIndexData, IDisposableFunctionCallIndex>.
import { FunctionCallIndexFactory } from '@rs-x/core';import {
InjectionContainer,
RsXCoreInjectionTokens,
RsXCoreModule,
type IFunctionCallIndexFactory,
} from '@rs-x/core';
await InjectionContainer.load(RsXCoreModule);
const factory = InjectionContainer.get<IFunctionCallIndexFactory>(
RsXCoreInjectionTokens.IFunctionCallIndexFactory,
);
const context = {
sum(a: number, b: number) {
return a + b;
},
};
const callIndex = factory.create({
context,
functionName: 'sum',import {
Inject,
RsXCoreInjectionTokens,
type IFunctionCallIndexFactory,
} from '@rs-x/core';
class IndexConsumer {
constructor(
@Inject(RsXCoreInjectionTokens.IFunctionCallIndexFactory)
private readonly functionCallIndexFactory: IFunctionCallIndexFactory,
) {}
}1 member in this class.
constructor(
@Inject(RsXCoreInjectionTokens.ISequenceIdFactory) private readonly _sequenceIdFactory: ISequenceIdFactory
)Parameters