From 75e8c87f093c88f85d267659aa408c9046043156 Mon Sep 17 00:00:00 2001 From: David Cormier Date: Sun, 27 Oct 2013 12:13:10 -0400 Subject: [PATCH] Group all messaging commands --- js/websockets.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/js/websockets.js b/js/websockets.js index ffdc607..84077aa 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -206,6 +206,18 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', return defer; } + /* + * Fails every currently subscribed callback for the + * given reason + * @param reason reason for failure + */ + failCallbacks = function(reason) { + for(i in callbacks) { + callbacks[i].cb.reject(reason); + } + + } + var send = function(message) { message.replace(/[\r\n]+$/g, "").split("\n"); var cb = createCallback(message); @@ -213,7 +225,6 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', return cb.promise; } - /* * Send all messages to the websocket and returns a promise that is resolved * when all message are resolved. @@ -310,21 +321,6 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', } ); - - - - } - - /* - * Fails every currently subscribed callback for the - * given reason - * @param reason reason for failure - */ - failCallbacks = function(reason) { - for(i in callbacks) { - callbacks[i].cb.reject(reason); - } - } websocket.onclose = function (evt) {