From 9b2838f364952fce110ab1d754c6b27b2ea7ee4a Mon Sep 17 00:00:00 2001 From: James Lal Date: Mon, 7 Jan 2013 08:31:48 +0100 Subject: use progress events --- lib/caldav/request/abstract.js | 6 +++++- lib/caldav/sax.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/caldav/request/abstract.js b/lib/caldav/request/abstract.js index 41429c6..eb6297b 100644 --- a/lib/caldav/request/abstract.js +++ b/lib/caldav/request/abstract.js @@ -60,12 +60,16 @@ var req = this.xhr; req.data = this._createPayload(); + req.ondata = function xhrOnData(chunk) { + self.sax.write(chunk); + }; + // in the future we may stream data somehow req.send(function xhrResult() { var xhr = req.xhr; if (xhr.status > 199 && xhr.status < 300) { // success - self.sax.write(xhr.responseText).close(); + self.sax.close(); self._processResult(req, callback); } else { // fail diff --git a/lib/caldav/sax.js b/lib/caldav/sax.js index ecc229e..e0c0a1b 100644 --- a/lib/caldav/sax.js +++ b/lib/caldav/sax.js @@ -102,6 +102,10 @@ return this._parse.write(chunk); }, + close: function() { + this._parse.close(); + }, + get closed() { return this._parse.closed; }, -- cgit