Member Junction
    Preparing search index...

    Runs an engine's load so concurrent callers share it, without letting a forced reload return a load that may have read before the caller asked.

    • A call while nothing is loading starts the load.
    • A call without forceRefresh while a load is running waits for that load.
    • A call with forceRefresh while a load is running waits for it and then runs one more load, because the running load may have read before the caller's own writes. Forced calls that arrive before that extra load starts share it, so a burst of Config(true) calls costs at most one extra load. A forced call that arrives once the extra load is running queues another.

    Loads never overlap: the extra load starts only after the running one has settled, so an older read can never land after a newer one. BaseEngine.Load follows the same rules; engines that wrap a BaseEngine with their own Config use this class.

    private _load = new SharedLoad();

    public async Config(forceRefresh?: boolean, contextUser?: UserInfo): Promise<void> {
    if (this._loaded && !forceRefresh) return;
    return this._load.Run(forceRefresh === true, () => this.innerLoad(forceRefresh, contextUser));
    }
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Runs load, or joins the load that is running, as described on the class.

      Parameters

      • forceRefresh: boolean

        True when the caller needs a load that starts after this call.

      • load: () => Promise<void>

        Starts one load. For a forced call that has to wait, the queued load uses the load of the first forced call that queued it.

      Returns Promise<void>

      Settles with the load the caller ends up on; rejects when that load rejects.