[Common] refactored plugin's messages

This commit is contained in:
Maxim Kadushkin 2017-03-03 12:45:37 +03:00
parent 0cc19d4640
commit a715009eee

View file

@ -258,22 +258,20 @@
};
var _onMessage = function(msg) {
if (msg && msg.frameEditorId == placeholderId) {
if ( msg ) {
if ( msg.type === "onExternalPluginMessage" ) {
_sendCommand(msg);
} else
if ( msg.frameEditorId == placeholderId ) {
var events = _config.events || {},
handler = events[msg.event],
res;
if (msg.event === 'onRequestEditRights' && !handler) {
_applyEditRights(false, 'handler is\'n defined');
} else
if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
} else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
_callLocalStorage(msg.data.data);
} else {
if (msg.type === "onExternalPluginMessage") {
_sendCommand(msg);
return;
}
if (msg.event === 'onReady') {
_onReady();
}
@ -286,6 +284,7 @@
}
}
}
}
};
var _checkConfigParams = function() {