Skip to content

Commit 75c2d80

Browse files
committed
feat: add flag for buffering the results
1 parent 13e3323 commit 75c2d80

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/ldf-client-ui.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ if (typeof global.process === 'undefined')
849849
this._handleGeospatialResult(result);
850850
}
851851
},
852-
_process_map_data: function () {
852+
_processMapData: function () {
853853
var self = this;
854854
const resultsToProcess = this._mapResultsBuffer.splice(0);
855855
for (const bindings of resultsToProcess) {
@@ -908,14 +908,20 @@ if (typeof global.process === 'undefined')
908908
}
909909
}
910910
}
911+
this._processingScheduled = false;
911912
},
912913

913914
// If the given result contains geospatial data, show it on the map
914915
_handleGeospatialResult: function (bindings) {
915916
if (!this._mapResultsBuffer) this._mapResultsBuffer = [];
916917
this._mapResultsBuffer.push(bindings);
917918

918-
requestAnimationFrame(this._process_map_data.bind(this));
919+
if (this._mapResultsBuffer.length > 0) {
920+
if (!this._processingScheduled) {
921+
this._processingScheduled = true;
922+
requestAnimationFrame(this._processMapData.bind(this));
923+
}
924+
}
919925
},
920926

921927
// Finalizes the display after all results have been added

0 commit comments

Comments
 (0)