debug console logs

This commit is contained in:
Iuri Matias 2018-06-04 15:44:17 -04:00
parent 1821e89346
commit 37ade68804
1 changed files with 13 additions and 0 deletions

View File

@ -28,6 +28,9 @@ class IPC {
on(action, done) {
ipc.server.on('message', function(data, socket) {
console.dir("received message");
console.dir(action);
console.dir(data);
if (data.action !== action) {
return;
}
@ -36,19 +39,29 @@ class IPC {
}
reply(client, action, data) {
console.dir("reply message");
console.dir(action);
console.dir(data);
ipc.server.emit(client, 'message', {action: action, message: data});
}
once(action, cb) {
ipc.of['embark'].once('message', function(msg) {
console.dir("once message");
console.dir(action);
console.dir(msg);
if (msg.action !== action) {
return;
}
console.dir('received');
cb(msg.message);
});
}
request(action, data) {
console.dir("request message");
console.dir(action);
console.dir(data);
ipc.of['embark'].emit('message', {action: action, message: data});
}