-
Notifications
You must be signed in to change notification settings - Fork 37
feat: buffer map results and move to non-blocking #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
use requestAnimationFrame to handle the parsing and updating of the map in between renderes of the browser also use buffering to add as much points as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
src/ldf-client-ui.js
Outdated
|
||
// If the given result contains geospatial data, show it on the map | ||
_handleGeospatialResult: function (bindings) { | ||
_process_map_data: function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_process_map_data: function () { | |
_processMapData: function () { |
src/ldf-client-ui.js
Outdated
if (!this._mapResultsBuffer) this._mapResultsBuffer = []; | ||
this._mapResultsBuffer.push(bindings); | ||
|
||
requestAnimationFrame(this._process_map_data.bind(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need a flag here to call requestAnimationFrame
only once. After the callback is invoked, the flag can be reset, to allow future requestAnimationFrame
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, something like this:
if (this._mapResultsBuffer.length > 0) {
if (!this._processingScheduled) {
this._processingScheduled = true;
requestAnimationFrame(this._processMapData.bind(this));
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
src/ldf-client-ui.js
Outdated
// Show map if it's not visible yet | ||
if (!self.$mapWrapper.is(':visible')) | ||
self.$mapWrapper.show(); | ||
if (this._mapResultsBuffer.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we just pushed something to the buffer, this length check can be removed.
Nice work @milafrerichs! |
Description
use requestAnimationFrame to handle the parsing and updating of the map in between renderes of the browser
also use buffering to add as much points as possible
Relaxed Issue
#90