When document layer is not ready and socket message is not delayed, message is lost.
Wait for doclayer to be ready in this case. Signed-off-by: Gökay Şatır <gokaysatir@gmail.com> Change-Id: Ib3e9427a89e8be7d97f7baf92bdcb6295c695ca2
This commit is contained in:
parent
8570a03555
commit
e660bb8e66
1 changed files with 14 additions and 0 deletions
|
@ -1187,6 +1187,20 @@ app.definitions.Socket = L.Class.extend({
|
|||
if (this._map._docLayer && !msgDelayed) {
|
||||
this._map._docLayer._onMessage(textMsg, e.image);
|
||||
}
|
||||
else if (!this._map._docLayer && !msgDelayed) {
|
||||
// If message is delayed and document layer is not ready at the time, message gets lost.
|
||||
// To prevent this, we wait a little for document layer.
|
||||
var waitForDocLayer = function(message, image) {
|
||||
setTimeout(function() {
|
||||
if (this._map._docLayer)
|
||||
this._map._docLayer._onMessage(message, image);
|
||||
else
|
||||
waitForDocLayer(message, image);
|
||||
}.bind(this), 300);
|
||||
}.bind(this);
|
||||
|
||||
waitForDocLayer(textMsg, e.image);
|
||||
}
|
||||
},
|
||||
|
||||
_exportAsCallback: function(command) {
|
||||
|
|
Loading…
Reference in a new issue