Skip to content

Commit

Permalink
DataProvider could return a promise
Browse files Browse the repository at this point in the history
  • Loading branch information
jbicker committed Jan 17, 2019
1 parent 0cdba42 commit 91e43d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions timeline-chart/src/layer/time-graph-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface TimeGraphRowElementMouseInteractions {
}

export interface TimeGraphChartProviders {
dataProvider: (range: TimelineChart.TimeGraphRange, resolution: number) => { rows: TimelineChart.TimeGraphRowModel[], range: TimelineChart.TimeGraphRange, resolution: number } | undefined
dataProvider: (range: TimelineChart.TimeGraphRange, resolution: number) => Promise<{ rows: TimelineChart.TimeGraphRowModel[], range: TimelineChart.TimeGraphRange, resolution: number }> | { rows: TimelineChart.TimeGraphRowModel[], range: TimelineChart.TimeGraphRange, resolution: number } | undefined
rowElementStyleProvider?: (el: TimelineChart.TimeGraphRowElementModel) => TimeGraphRowElementStyle | undefined
rowStyleProvider?: (row: TimelineChart.TimeGraphRowModel) => TimeGraphRowStyle | undefined
}
Expand Down Expand Up @@ -112,7 +112,7 @@ export class TimeGraphChart extends TimeGraphChartLayer {

update() { }

protected maybeFetchNewData() {
protected async maybeFetchNewData() {
const resolution = this.unitController.viewRangeLength / this.stateController.canvasDisplayWidth;
const viewRange = this.unitController.viewRange;
if (viewRange && (
Expand All @@ -121,7 +121,7 @@ export class TimeGraphChart extends TimeGraphChartLayer {
resolution < this.providedResolution
)) {
this.fetching = true;
const rowData = this.providers.dataProvider(viewRange, resolution);
const rowData = await this.providers.dataProvider(viewRange, resolution);
if (rowData) {
this.providedResolution = rowData.resolution;
this.providedRange = rowData.range;
Expand Down

0 comments on commit 91e43d1

Please sign in to comment.