ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [13/17] incubator-ponymail git commit: cleanup var names and comments
Date Fri, 02 Sep 2016 07:44:15 GMT
cleanup var names and comments


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

Branch: refs/heads/coffee-and-cake
Commit: effc1724c19b76768323218565ea6513f91e2660
Parents: 16ad6c0
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Fri Sep 2 09:18:19 2016 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Fri Sep 2 09:18:19 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/http_utils.coffee | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/effc1724/site/js/coffee/http_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/http_utils.coffee b/site/js/coffee/http_utils.coffee
index 23bc447..fd95e7d 100644
--- a/site/js/coffee/http_utils.coffee
+++ b/site/js/coffee/http_utils.coffee
@@ -45,6 +45,7 @@
 
 class HTTPRequest
     constructor = (@url, @args) ->
+        # Set internal class data, determine request type
         @state = @args.state
         @method = if @args.data then 'POST' else 'GET'
         @data = @args.data
@@ -85,28 +86,29 @@ class HTTPRequest
                     @url += "?" + tmp
                 
         # Use @method on URL
-        @requestobj.open(@method, @url, true)
+        @request.open(@method, @url, true)
         
         # Send data
-        @requestobj.send(@rdata)
+        @request.send(@rdata)
         
         # Set onChange behavior
-        @requestobj.onreadystatechange = @onchange
+        @request.onreadystatechange = @onchange
         
         # all done!
         
+    # HTTPRequest state change calback
     onchange = () ->
             # Internal Server Error: Try to call snap
-            if @requestobj.readyState == 4 and @requestobj.status == 500
+            if @request.readyState == 4 and @request.status == 500
                 if @snap
                     @snap(@state)
             # 200 OK, everything is okay, try to parse JSON response
-            if @requestobj.readyState == 4 and @requestobj.status == 200
+            if @request.readyState == 4 and @request.status == 200
                 if @callback
                     # Try to parse as JSON and deal with cache objects, fall back to old
style parse-and-pass
                     try
                         # Parse JSON response
-                        @response = JSON.parse(xmlHttp.responseText)
+                        @response = JSON.parse(@request.responseText)
                         # If loginRequired (rare!), redirect to oauth page
                         if @response && @response.loginRequired
                             location.href = "/oauth.html"
@@ -115,7 +117,7 @@ class HTTPRequest
                         @callback(@response, @state);
                     # JSON parse failed? Pass on the response as plain text then
                     catch e
-                        @callback(@requestobj.responseText, @state)
+                        @callback(@request.responseText, @state)
         
     # Standard form data joiner for POST data
     formdata = (kv) ->


Mime
View raw message