From 74a33200aaeea59b5c9f2a47c20859965f1d0407 Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 15 May 2016 18:05:17 -0400 Subject: [PATCH] add comments for the cljs browserchannel enum equivalents --- .../net/thegeez/browserchannel/client.cljs | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs b/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs index 05649e0..bff0cfe 100644 --- a/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs +++ b/clj-browserchannel/src/net/thegeez/browserchannel/client.cljs @@ -9,26 +9,28 @@ (defonce channel (goog.net.BrowserChannel.)) -; see: https://google.github.io/closure-library/api/source/closure/goog/net/browserchannel.js.src.html#l470 (def ^:private bch-state-enum-to-keyword - {0 :closed - 1 :init - 2 :opening - 3 :opened}) + { + 0 :closed ; channel is closed + 1 :init ; channel has been initialized but hasn't yet initiated a connection + 2 :opening ; channel is in the process of opening a connection to the server + 3 :opened ; channel is open + }) -; see: https://google.github.io/closure-library/api/source/closure/goog/net/browserchannel.js.src.html#l521 (def ^:private bch-error-enum-to-keyword - {0 :ok - 2 :request-failed - 4 :logged-out - 5 :no-data - 6 :unknown-session-id - 7 :stop - 8 :network - 9 :blocked - 10 :bad-data - 11 :bad-response - 12 :active-x-blocked}) + { + 0 :ok ; indicates no error has occurred + 2 :request-failed ; error due to a request failing + 4 :logged-out ; error due to the user being logged out + 5 :no-data ; error due to server response which contains no data + 6 :unknown-session-id ; error due to a server response indicating an unknown session id (also happens after a session timeout) + 7 :stop ; error due to a server response requesting to stop the channel (client ideally will not treat this as an error) + 8 :network ; general network error + 9 :blocked ; error due to the channel being blocked by a network administrator + 10 :bad-data ; error due to bad data being returned from the server + 11 :bad-response ; error due to a response that doesn't start with the magic cookie + 12 :active-x-blocked ; activex is blocked by the machine's admin settings + }) (defn- encode-map [data]