Hex Core JS
    Preparing search index...

    Class RuntimeRegistry<T>

    Solves circular import issues by populating mutually referencing objects at runtime.

    To use, create a new registry. In each file in the import cycle, register the relevant object by calling the register method. In the nearest shared importing ancestor file (e.g. closest index.ts barrel file), call the run method on the registry after importing/exporting all other files.

    Type Parameters

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    name: string

    Methods

    • Register a new object.

      Parameters

      • name: string

        The name of the object. Referenced by other objects.

      • obj: T

        The object.

      • Optionaltargets: Partial<
            {
                [K in string
                | number
                | symbol]:
                    | string
                    | Partial<
                        {
                            [K in string
                            | number
                            | symbol]:
                                | string
                                | Partial<
                                    { [K in string
                                    | number
                                    | symbol]: string | Partial<(...)> },
                                >
                        },
                    >
            },
        >

        A mapping from keys of the object to other object names. Should mirror the structure of obj.

      Returns void

    • Populate the registered objects.

      Returns void