UNPKG

parallel-es

Version:
25 lines (24 loc) 1.07 kB
import { IFunctionDefinition } from "./function-defintion"; import { IFunctionId } from "./function-id"; /** * Lookup table for resolving dynamic functions and their definitions */ export declare class DynamicFunctionRegistry { private ids; private definitions; private lastId; /** * Returns the unique id for the passed in function or assigns a new id to the given function and returns the newly assigned id * @param func the function for which the unique id should be determined * @returns the id of this function */ getOrSetId(func: Function | IFunctionId): IFunctionId; /** * Returns the definition of the function with the given id or undefined, if the id is not assigned to any function definition * @param id the id of the function to resolve * @returns the resolved function definition or undefined * @throws if the function is a static function and therefore no definition exists. */ getDefinition(id: IFunctionId): IFunctionDefinition | undefined; private initDefinition(func, id); }