Загрузка данных


private scheduleHistoryBatch = () => {
  if (this.historyBatchRunning) return;

  this.historyBatchRunning = true;

  requestAnimationFrame(() => {
    const symbolIds =
      this.activeSymbolIds.slice();

    Promise.all(
      symbolIds.map((symbolId) =>
        this.dataSource.loadMoreHistory(
          symbolId,
        ),
      ),
    ).finally(() => {
      this.historyBatchRunning = false;

      const range =
        this.lwcChart
          .timeScale()
          .getVisibleLogicalRange();

      if (
        range &&
        range.from <
          HISTORY_LOAD_THRESHOLD
      ) {
        this.scheduleHistoryBatch();
      }
    });
  });
};