Fixed broken GCODE viewer / concurrent settings requests
The GCODE viewer settings callback was not properly called, hence the viewer was not initialized properly. Changed prevention of concurrent settings requests to properly handle the situation where the registered settings callbacks might be extended through another callback.
This commit is contained in:
parent
a43de4201f
commit
7d6462b815
1 changed files with 12 additions and 7 deletions
|
|
@ -279,20 +279,25 @@ $(function() {
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
var callbacks = self.callbacks;
|
|
||||||
self.callbacks = [];
|
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callbacks.push(callback);
|
self.callbacks.push(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
self.fromResponse(response);
|
self.fromResponse(response);
|
||||||
_.each(callbacks, function(cb) {
|
|
||||||
cb();
|
var cb;
|
||||||
});
|
while (self.callbacks.length) {
|
||||||
|
cb = self.callbacks.shift();
|
||||||
|
try {
|
||||||
|
cb();
|
||||||
|
} catch(exc) {
|
||||||
|
log.error("Error calling settings callback", cb, ":", (exc.stack || exc));
|
||||||
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
self.receiving(false);
|
self.receiving(false);
|
||||||
|
self.callbacks = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue