You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/09/01 16:20:45 UTC

cordova-wp8 git commit: Added the XHR upload attribute

Repository: cordova-wp8
Updated Branches:
  refs/heads/master ec401c9e2 -> 81a8d3e17


Added the XHR upload attribute

Added the XHR upload attribute as defined by https://xhr.spec.whatwg.org/#the-upload-attribute and documented at MDN here https://developer.mozilla.org/de/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Monitoring_progress

This is required by https://github.com/doedje/jquery.soap/blob/master/jquery.soap.js#L281 and will throw a exception if not present.

This closes #84


Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/81a8d3e1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/81a8d3e1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/81a8d3e1

Branch: refs/heads/master
Commit: 81a8d3e17c9d879c92d3349bd7166557d14e5bf9
Parents: ec401c9
Author: André Fiedler <Su...@users.noreply.github.com>
Authored: Fri Jun 19 10:18:49 2015 +0200
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Tue Sep 1 17:19:34 2015 +0300

----------------------------------------------------------------------
 template/cordovalib/XHRHelper.cs | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/81a8d3e1/template/cordovalib/XHRHelper.cs
----------------------------------------------------------------------
diff --git a/template/cordovalib/XHRHelper.cs b/template/cordovalib/XHRHelper.cs
index 50120ca..02e115c 100644
--- a/template/cordovalib/XHRHelper.cs
+++ b/template/cordovalib/XHRHelper.cs
@@ -153,6 +153,28 @@ namespace WPCordovaClassLib.CordovaLib
                         this.wrappedXHR.onreadystatechange = function() {
                             self.changeReadyState(self.wrappedXHR.readyState);
                         };
+                        if (this.wrappedXHR && this.wrappedXHR.upload) {
+                            this.wrappedXHR.upload.onprogress = function(e) {
+                                if (typeof self.upload.onprogress === 'function') {
+                                    self.upload.onprogress(e);
+                                }
+                            };
+                            this.wrappedXHR.upload.onload = function(e) {
+                                if (typeof self.upload.onload === 'function') {
+                                    self.upload.onload(e);
+                                }
+                            };
+                            this.wrappedXHR.upload.onerror = function(e) {
+                                if (typeof self.upload.onerror === 'function') {
+                                    self.upload.onerror(e);
+                                }
+                            };
+                            this.wrappedXHR.upload.onabort = function(e) {
+                                if (typeof self.upload.onabort === 'function') {
+                                    self.upload.onabort(e);
+                                }
+                            };
+                        }
                     }
                     return this.wrappedXHR.open(reqType, uri, isAsync, user, password);
                 }
@@ -276,7 +298,14 @@ namespace WPCordovaClassLib.CordovaLib
                     this.isAsync ? setTimeout(funk, 0) : funk();
                 }
             },
-            status: 404
+            status: 404,
+			upload: {
+				addEventListener: function (type, listener, useCapture){
+					if (this.wrappedXHR && this.wrappedXHR.upload) {
+						this.wrappedXHR.upload.addEventListener(type, listener, useCapture);
+					}
+				}
+			}
         };
     }
 })(window, document); ";


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org