mirror of
https://github.com/danbulant/node-x11
synced 2026-05-24 12:35:39 +00:00
connet handler as a parameter to createClient
This commit is contained in:
parent
b1625af9ca
commit
8cf496a220
1 changed files with 20 additions and 12 deletions
|
|
@ -288,7 +288,7 @@ var platformDefaultTransport = {
|
||||||
// TODO: check process.platform on SmartMachine solaris box
|
// TODO: check process.platform on SmartMachine solaris box
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.createClient = function()
|
module.exports.createClient = function(initCb)
|
||||||
{
|
{
|
||||||
// TODO: parse $DISPLAY
|
// TODO: parse $DISPLAY
|
||||||
|
|
||||||
|
|
@ -301,5 +301,13 @@ module.exports.createClient = function()
|
||||||
if (defaultTransportName == 'unix')
|
if (defaultTransportName == 'unix')
|
||||||
stream = net.createConnection('/tmp/.X11-unix/X0');
|
stream = net.createConnection('/tmp/.X11-unix/X0');
|
||||||
|
|
||||||
return new XClient(stream);
|
var client = new XClient(stream);
|
||||||
|
if (initCb)
|
||||||
|
{
|
||||||
|
client.on('connect', function(display) {
|
||||||
|
display.client = client;
|
||||||
|
initCb(display);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue