Skip to content
Snippets Groups Projects
Commit 26727cf8 authored by hristoterezov's avatar hristoterezov
Browse files

fix(remotecontrol): format of events

parent 20351a47
No related branches found
No related tags found
No related merge requests found
......@@ -68,8 +68,12 @@ class RemoteControl {
this.windowManager = windowManager;
this.channel = channel;
this.channel.ready(() => {
this.channel.listen(REMOTE_CONTROL_EVENT_TYPE,
event => this.onRemoteControlEvent(event));
this.channel.listen('message', message => {
const event = message.data;
if(event.name === REMOTE_CONTROL_EVENT_TYPE) {
this.onRemoteControlEvent(event);
}
});
this.sendEvent({type: EVENT_TYPES.supported});
});
}
......@@ -199,9 +203,13 @@ class RemoteControl {
* @param {Object} event the remote control event.
*/
sendEvent(event) {
const remoteControlEvent = Object.assign(
{ name: REMOTE_CONTROL_EVENT_TYPE },
event
);
this.channel.send({
method: REMOTE_CONTROL_EVENT_TYPE,
params: [event]
method: 'message',
params: { data: remoteControlEvent }
});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment