mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(socket) setListeners
This commit is contained in:
parent
67438d3bbf
commit
9283f7c4a7
1 changed files with 6 additions and 10 deletions
|
|
@ -57,20 +57,16 @@ var CloudCmd, Util, DOM, CloudFunc, io;
|
|||
}
|
||||
|
||||
function setListeners(all, socket) {
|
||||
var i, n, name, func, listeners;
|
||||
var listeners;
|
||||
|
||||
for (name in all) {
|
||||
Object.keys(all).forEach(function(name) {
|
||||
listeners = all[name];
|
||||
n = listeners.length;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
func = listeners[i];
|
||||
|
||||
if (func && socket)
|
||||
listeners.forEach(function(func) {
|
||||
if (func)
|
||||
socket.on(name, func);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function connect() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue