EventBus.$emit('DATA_EVENT', 'logOut'); send as method

Dear forum members,

Is it possible to execute a method on parent layout page with $emit ?

I have got a layout page and on mounted this methods running:

mounted: function() {

console.log(‘Layout Page mounted’);

EventBus.$on(‘DATA_EVENT’, (command) => {
console.log(command);
switch(command){
case “logOut”:
this.logOut();
break;
default:
console.log(‘switch not found any command’);
break;
}
});

Also I have got a login page and in this page this line is running:

.
.
EventBus.$emit(‘DATA_EVENT’, ‘logOut’);
.

.

but I would like to execute on layout page as:

mounted: function() {

console.log(‘Layout Page mounted’);

EventBus.$on(‘DATA_EVENT’, (command) => {
if(command){
this.command;
}
});

Is it possible?

Thanks in advance

Hi

You should be able to run it by using:

this[command]()