Start listening for standard post messages and ignore deprecated ones (#126)
New online versions emits both the post messages (the older one with a deprecated flag and newer one without). Ignore if the deprecated flag is mentioned because it means that we would get another post message without deprecated flag.
This commit is contained in:
parent
0434e383ba
commit
72cb1956b0
@ -353,13 +353,25 @@ var documentsMain = {
|
||||
}
|
||||
|
||||
try {
|
||||
var msg = JSON.parse(e.data).MessageId;
|
||||
var msg = JSON.parse(e.data);
|
||||
var msgId = msg.MessageId;
|
||||
var args = msg.Values;
|
||||
var deprecated = !!args.Deprecated;
|
||||
} catch(exc) {
|
||||
msg = e.data;
|
||||
msgId = e.data;
|
||||
}
|
||||
if (msg === 'UI_Close' || msg === 'close') {
|
||||
|
||||
if (msgId === 'UI_Close' || msgId === 'close' /* deprecated */) {
|
||||
// If a postmesage API is deprecated, we must ignore it and wait for the standard postmessage
|
||||
// (or it might already have been fired)
|
||||
if (deprecated)
|
||||
return;
|
||||
|
||||
documentsMain.onClose();
|
||||
} else if (msg === 'rev-history') {
|
||||
} else if (msgId === 'UI_FileVersions' || msgId === 'rev-history' /* deprecated */) {
|
||||
if (deprecated)
|
||||
return;
|
||||
|
||||
documentsMain.UI.showRevHistory(documentsMain.fullPath);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user