solarnetwork-api-core
    Preparing search index...

    Class MultiLoader<T>

    Load data from multiple Loader objects, invoking a callback function after all data has been loaded. Call MultiLoader#load to start loading the data.

    The Tool.DatumLoader class conforms to the Loader interface, so can be used to load arrays of Domain.Datum objects based on search criteria.

    const filter1 = new DatumFilter();
    filter1.nodeId = 123;
    // configure other filter settings here...

    const filter2 = new DatumFilter();
    filter2.nodeId = 234;
    // configure other filter settings here

    const api = new SolarQueryApi();

    const results = await new MultiLoader([
    new DatumLoader(api, filter1),
    new DatumLoader(api, filter2),
    ]).fetch();
    // results is a 2-element array of Datum arrays

    result data type

    Type Parameters

    • T
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Get the concurrency limit to use for parallel requests.

      Returns number

      the current concurrency value; defaults to Infinity

    • Set the concurrency limit to use for parallel loading.

      By default loaders are executed in parallel. Change to a positive number to control the concurrency of the loader execution, for example set to 1 for serial execution.

      Parameters

      • value: number

        the concurrency level to use, or Infinity for no limit

      Returns this

      this object