API Reference

FunctionCallIndexFactoryclass

Factory service that creates and reuses function-call index objects from context, function name, and arguments.

When to use

Base class: KeyedInstanceFactory<IISequenceWithIdData, IFunctionCallIndexData, IDisposableFunctionCallIndex>.

Import

import { FunctionCallIndexFactory } from '@rs-x/core';

Example

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',

Constructor injection example

import {
  Inject,
  RsXCoreInjectionTokens,
  type IFunctionCallIndexFactory,
} from '@rs-x/core';

class IndexConsumer {
  constructor(
    @Inject(RsXCoreInjectionTokens.IFunctionCallIndexFactory)
    private readonly functionCallIndexFactory: IFunctionCallIndexFactory,
  ) {}
}

Members

1 member in this class.

constructor
constructor
constructor(
  @Inject(RsXCoreInjectionTokens.ISequenceIdFactory) private readonly _sequenceIdFactory: ISequenceIdFactory
)

Parameters

Name
Type
Required
_sequenceIdFactory
ISequenceIdFactory
required