mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added checkpoint output, setting up a channel
This commit is contained in:
parent
dd154aa576
commit
c2ed00cb9b
10 changed files with 115 additions and 79 deletions
|
|
@ -1,24 +1,27 @@
|
|||
define([
|
||||
//"Game/Core/NotificationCenter",
|
||||
"Game/Core/NotificationCenter",
|
||||
"child_process"
|
||||
],
|
||||
|
||||
function (childProcess) {
|
||||
function (NotificationCenter, childProcess) {
|
||||
|
||||
var fork = childProcess.fork;
|
||||
|
||||
function PipeToChannel (channelName) {
|
||||
|
||||
this.channelProcess = null;
|
||||
this.channelPipe = null;
|
||||
|
||||
try {
|
||||
this.channelProcess = fork('channel.js');
|
||||
this.channelPipe = fork('channel.js');
|
||||
} catch (err) {
|
||||
throw 'Failed to fork channel! (' + err + ')';
|
||||
}
|
||||
|
||||
this.send('channel/' + channelName, 'CREATE');
|
||||
this.channelProcess.on('message', this.onMessage.bind(this));
|
||||
console.checkpoint('creating channel process for ' + channelName);
|
||||
|
||||
this.send('channel/' + channelName, { CREATE: channelName });
|
||||
|
||||
this.channelPipe.on('message', this.onMessage.bind(this));
|
||||
|
||||
var self = this;
|
||||
}
|
||||
|
|
@ -29,7 +32,7 @@ function (childProcess) {
|
|||
data: data
|
||||
}
|
||||
|
||||
this.channelProcess.send(message);
|
||||
this.channelPipe.send(message);
|
||||
}
|
||||
|
||||
PipeToChannel.prototype.onMessage = function (message) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue