Use JSON objects for messaging.
Set timeout for closing the feedback dialogue to ensure that we sent the message. Signed-off-by: Gökay Şatır <gokay.satir@collabora.com> Change-Id: Ieaff907faac0506b065c991e5e8fac4ccad8d8e2pull/4292/head
parent
b965b90b3a
commit
1fe48cd0a0
|
@ -70,7 +70,7 @@ L.IFrameDialog = L.Class.extend({
|
|||
this._loading = true;
|
||||
setTimeout(function () {
|
||||
if (!that.isVisible()) {
|
||||
window.postMessage(msg);
|
||||
window.postMessage('{"MessageId":"' + msg + '"}');
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
|
|
|
@ -96,6 +96,7 @@ L.Map.Feedback = L.Handler.extend({
|
|||
|
||||
onMessage: function (e) {
|
||||
var data = e.data;
|
||||
data = JSON.parse(data).MessageId;
|
||||
|
||||
if (data == 'feedback-show') {
|
||||
this._iframeDialog.show();
|
||||
|
@ -112,7 +113,11 @@ L.Map.Feedback = L.Handler.extend({
|
|||
} else if (data == 'feedback-submit') {
|
||||
window.localStorage.setItem('WSDFeedbackEnabled', 'false');
|
||||
window.localStorage.removeItem('WSDFeedbackCount');
|
||||
this._iframeDialog.remove();
|
||||
var that = this;
|
||||
setTimeout(function() {
|
||||
that._iframeDialog.remove();
|
||||
}, 400);
|
||||
|
||||
} else if (data == 'iframe-feedback-load' && !this._iframeDialog.isVisible()) {
|
||||
this._iframeDialog.remove();
|
||||
setTimeout(L.bind(this.onFeedback, this), this._map.options.feedbackTimeout);
|
||||
|
|
|
@ -78,6 +78,7 @@ L.Map.Welcome = L.Handler.extend({
|
|||
|
||||
onMessage: function (e) {
|
||||
var data = e.data;
|
||||
data = JSON.parse(data).MessageId;
|
||||
|
||||
if (data === 'welcome-show') {
|
||||
this._iframeWelcome.show();
|
||||
|
|
Loading…
Reference in New Issue