mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
feature(terminal) add connect/disconnect events
This commit is contained in:
parent
8c4fe43aeb
commit
cbf7b2f9fd
1 changed files with 12 additions and 2 deletions
|
|
@ -109,9 +109,19 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
|
|||
}
|
||||
|
||||
function addListeners(callback) {
|
||||
var socket = CloudCmd.Socket;
|
||||
var socket = CloudCmd.Socket,
|
||||
options = {
|
||||
'connect': function() {
|
||||
write(socket.CONNECTED + '\r');
|
||||
},
|
||||
'disconnect': function() {
|
||||
write(socket.DISCONNECTED +'\r');
|
||||
},
|
||||
};
|
||||
|
||||
socket.on(CHANNEL, write);
|
||||
options[CHANNEL] = write;
|
||||
|
||||
socket.on(options);
|
||||
|
||||
Term.on('data', function(data) {
|
||||
socket.emit(CHANNEL, data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue