diff options
author | Hiroshi Ichikawa <gimite@gmail.com> | 2011-03-05 09:46:20 +0900 |
---|---|---|
committer | Hiroshi Ichikawa <gimite@gmail.com> | 2011-03-05 09:46:20 +0900 |
commit | 7761b25d125a3425a8daeb90e33d9ed1485d7ca5 (patch) | |
tree | 12c7c5ab3594950b66dc764c6f15af898f6d2d56 /web_socket.js | |
parent | d9fea247acb905a993a6d17fa1eb0bab2322ebd8 (diff) | |
download | web-socket-js-7761b25d125a3425a8daeb90e33d9ed1485d7ca5.tar.gz |
Style change.
Diffstat (limited to 'web_socket.js')
-rw-r--r-- | web_socket.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/web_socket.js b/web_socket.js index abd5093..70e5fae 100644 --- a/web_socket.js +++ b/web_socket.js @@ -150,7 +150,7 @@ }; /** - * Handle an event from flash. Do any websocket-specific + * Handle an event from Flash. Do any WebSocket-specific * handling before passing the event off to the event handlers. * @param {Object} event */ @@ -161,11 +161,11 @@ try { if (event.type == "open") { - this.onopen && this.onopen(); + if (this.onopen) this.onopen(); } else if (event.type == "close") { - this.onclose && this.onclose(); + if (this.onclose) this.onclose(); } else if (event.type == "error") { - this.onerror && this.onerror(event); + if (this.onerror) this.onerror(event); } else if (event.type == "message") { if (this.onmessage) { var data = decodeURIComponent(event.message); @@ -179,12 +179,11 @@ } this.onmessage(e); } - } else { throw "unknown event type: " + event.type; } } catch (e) { - console.error(e.toString()); + console.error(e); } }; |