Всем привет, просветите пожалуйста.
Задача отправить некоторое сообщение из LeadPage в LeadSection.
Lead Page:
messages: {
"MESSAGE": {
mode: Terrasoft.MessageMode.PTP,
direction: Terrasoft.MessageDirectionType.PUBLISH
}
},
methods: {
onEntityInitialized : function(){
this.callParent();
window.console.log("onEntityInitialized");
this.sandbox.publish("MESSAGE", { test: "param anything" }, [this.sandbox.id]);
console.log("MESSAGE IS PUBLISH...");
}
}
Вопрос в том как динамически перехватить это сообщение в LeadSection?
Т.е как организовать слушателя событий на стороне LeadSection?
Сейчас тупо использую простую функцию определенную в LeadSection, но она отрабатывает только если ее инициализировать руками.
LeadSection
messages: {
"MESSAGE": {
mode: Terrasoft.MessageMode.PTP,
direction: Terrasoft.MessageDirectionType.PUBLISH
}
},
methods: {
initMessage: function() {
console.log("initMessage");
this.sandbox.subscribe("MESSAGE", function(arg) {
console.log("test " + arg.test);
}, this, [this.getSenderSandboxId()]);
}
}