You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/06/28 08:46:04 UTC

[13/37] incubator-weex git commit: * [html5] fix websocket module dange code

* [html5] fix websocket module dange code


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e6b55f7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e6b55f7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e6b55f7c

Branch: refs/heads/0.15-dev
Commit: e6b55f7c3bde474a75dfc9757b2e5f0b0b180d93
Parents: 323b836
Author: erha19 <fa...@gmail.com>
Authored: Fri Jun 23 17:34:44 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Fri Jun 23 17:34:44 2017 +0800

----------------------------------------------------------------------
 html5/render/vue/modules/websocket/websocket.js | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e6b55f7c/html5/render/vue/modules/websocket/websocket.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/modules/websocket/websocket.js b/html5/render/vue/modules/websocket/websocket.js
index b430789..743dc1d 100644
--- a/html5/render/vue/modules/websocket/websocket.js
+++ b/html5/render/vue/modules/websocket/websocket.js
@@ -19,35 +19,36 @@
 /**
  * websocket module
  */
-export default (function() {
+export default (function () {
   const registerListeners = ['onopen', 'onmessage', 'onerror', 'onclose']
   const ws = {
     INSTANCE: null,
-    WebSocket: function(url, protocol) {
+    WebSocket: function (url, protocol) {
       if (!url) {
         return
       }
       if (!protocol) {
         ws.INSTANCE = new WebSocket(url)
-      } else {
+      }
+      else {
         ws.INSTANCE = new WebSocket(url, protocol)
       }
       return ws.INSTANCE
     },
-    send: function(messages) {
+    send: function (messages) {
       ws.INSTANCE && ws.INSTANCE.send(messages)
     },
-    close: function() {
+    close: function () {
       ws.INSTANCE && ws.INSTANCE.close()
     }
   }
   for (const i in registerListeners) {
     if (registerListeners.hasOwnProperty(i)) {
       Object.defineProperty(ws, registerListeners[i], {
-        get: function() {
+        get: function () {
           return ws.INSTANCE && ws.INSTANCE[registerListeners[i]]
         },
-        set: function(fn) {
+        set: function (fn) {
           if (ws.INSTANCE) {
             ws.INSTANCE[registerListeners[i]] = fn
           }
@@ -56,4 +57,4 @@ export default (function() {
     }
   }
   return ws
-})()
\ No newline at end of file
+})()