import type { DataEventCallback, DataEventEmitter } from './DataEvent'; import type DataConnectorType from './Connectors/DataConnectorType'; import type { DataConnectorTypeOptions } from './Connectors/DataConnectorType'; import type DataPoolOptions from './DataPoolOptions'; /** * Data pool to load connectors on-demand. * * @class * @name Data.DataPool * * @param {DataPoolOptions} options * Pool options with all connectors. */ declare class DataPool implements DataEventEmitter { protected static readonly defaultOptions: DataPoolOptions; /** * Internal dictionary with the connectors and their IDs. */ protected readonly connectors: Record; /** * Pool options with all connectors. */ readonly options: DataPoolOptions; /** * Internal dictionary with the promise resolves waiting for connectors to * be done loading. */ protected readonly waiting: Record; constructor(options?: DataPoolOptions); /** * Emits an event on this data pool to all registered callbacks of the given * event. * * @param {DataTableEvent} e * Event object with event information. */ emit(e: Event): void; /** * Loads the connector. * * @function Data.DataPool#getConnector * * @param {string} connectorId * ID of the connector. * * @return {Promise} * Returns the connector. */ getConnector(connectorId: string): Promise; /** * Returns the IDs of all connectors. * * @private * * @return {Array} * Names of all connectors. */ getConnectorIds(): Array; /** * Loads the options of the connector. * * @private * * @param {string} connectorId * ID of the connector. * * @return {DataConnectorTypeOptions | undefined} * Returns the options of the connector, or `undefined` if not found. */ protected getConnectorOptions(connectorId: string): DataConnectorTypeOptions | undefined; /** * Tests whether the connector has never been requested. * * @param {string} connectorId * Name of the connector. * * @return {boolean} * Returns `true`, if the connector has never been requested, otherwise * `false`. */ isNewConnector(connectorId: string): boolean; /** * Instantiates the connector class for the given options and loads its * data. * * @private * * @param {Data.DataPoolConnectorOptions} options * Options of connector. * * @return {Promise} * Returns the connector. */ protected loadConnector(options: DataConnectorTypeOptions): Promise; /** * Cancels all data connectors pending requests. */ cancelPendingRequests(): void; /** * Registers a callback for a specific event. * * @function Highcharts.DataPool#on * * @param {string} type * Event type as a string. * * @param {Highcharts.EventCallbackFunction} callback * Function to register for an event callback. * * @return {Function} * Function to unregister callback from the event. */ on(type: T, callback: DataEventCallback>): Function; setConnectorOptions(options: DataConnectorTypeOptions, update?: boolean): void; setConnectorOptions(options: DataConnectorTypeOptions, update: true): Promise; } export interface Event { type: ('load' | 'afterLoad' | 'setConnectorOptions' | 'afterSetConnectorOptions'); options: DataConnectorTypeOptions; } export default DataPool;