many optimizations in addresses pulling

This commit is contained in:
Matias Alejo Garcia 2014-05-16 18:33:06 -03:00
commit 398daf3f05
9 changed files with 183 additions and 130 deletions

View file

@ -19,7 +19,6 @@ angular.module('copay.socket').factory('Socket',
};
socket.on(event, wrappedCallback);
if (event !== 'connect') {
listeners.push({
event: event,
@ -27,6 +26,14 @@ angular.module('copay.socket').factory('Socket',
});
}
},
getListeners: function() {
var ret = {};
var addrList = listeners.map(function(i) {return i.event;});
for (var i in addrList) {
ret[addrList[i]] = 1;
}
return ret;
},
emit: function(event, data, callback) {
socket.emit(event, data, function() {
var args = arguments;