mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
minor changes
This commit is contained in:
parent
d6c46aa341
commit
3a83874398
1 changed files with 22 additions and 8 deletions
|
|
@ -3,9 +3,9 @@ var CloudCommander, io, socket;
|
|||
(function(){
|
||||
"use strict";
|
||||
|
||||
var cloudcmd = CloudCommander,
|
||||
Util = cloudcmd.Util,
|
||||
Term = cloudcmd.Terminal.JqueryTerminal.Term;
|
||||
var cloudcmd = CloudCommander,
|
||||
Util = cloudcmd.Util,
|
||||
JqueryTerminal = cloudcmd.Terminal.JqueryTerminal;
|
||||
|
||||
Util.jsload("/socket.io/lib/socket.io.js", {
|
||||
onload : function(){
|
||||
|
|
@ -14,17 +14,16 @@ var CloudCommander, io, socket;
|
|||
cloudcmd.Socket = socket;
|
||||
|
||||
socket.on('connect', function () {
|
||||
console.log('socket connected');
|
||||
outToTerminal('socket connected');
|
||||
});
|
||||
|
||||
socket.on('message', function (msg) {
|
||||
console.log(msg);
|
||||
if(Term)
|
||||
Term.echo(msg);
|
||||
outToTerminal(msg);
|
||||
|
||||
});
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
console.log('socket disconected');
|
||||
outToTerminal('socket disconected');
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -33,4 +32,19 @@ var CloudCommander, io, socket;
|
|||
'npm i socket.io');
|
||||
}
|
||||
});
|
||||
|
||||
function outToTerminal(pMsg){
|
||||
var lTerm = JqueryTerminal.Term,
|
||||
lResult = true;
|
||||
|
||||
if(lTerm)
|
||||
lResult = lTerm.echo(pMsg);
|
||||
else
|
||||
lResult = lTerm;
|
||||
|
||||
console.log(pMsg);
|
||||
|
||||
return lResult;
|
||||
}
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue