diff options
author | James Lal <james@lightsofapollo.com> | 2013-03-06 12:08:08 -0800 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2013-03-06 12:08:08 -0800 |
commit | 3c19897e7eb888c8127b19f65462f3f6927a20ce (patch) | |
tree | 03773ea36c777a6f5d0401c3b4fbebb20e74fbac /lib/caldav/xhr.js | |
parent | ee5ae7a9c6ca0ce6136e9b97d4388a1434467b8b (diff) | |
download | jsCalDAV-3c19897e7eb888c8127b19f65462f3f6927a20ce.tar.gz |
lint / make sure we really have .ondata
Diffstat (limited to 'lib/caldav/xhr.js')
-rw-r--r-- | lib/caldav/xhr.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/caldav/xhr.js b/lib/caldav/xhr.js index d49186b..77ecd5c 100644 --- a/lib/caldav/xhr.js +++ b/lib/caldav/xhr.js @@ -121,21 +121,23 @@ var last = 0; if (useMozChunkedText) { - xhr.onprogress = function onChunkedProgress(event) { - this.ondata(xhr.responseText); - }.bind(this); + xhr.onprogress = (function onChunkedProgress(event) { + if (this.ondata) { + this.ondata(xhr.responseText); + } + }.bind(this)); } else { - xhr.onprogress = function onProgress(event) { + xhr.onprogress = (function onProgress(event) { var chunk = xhr.responseText.substr(last, event.loaded); last = event.loaded; if (this.ondata) { this.ondata(chunk); } - }.bind(this); + }.bind(this)); } } - xhr.onreadystatechange = function onReadyStateChange() { + xhr.onreadystatechange = (function onReadyStateChange() { var data; if (xhr.readyState === 4) { data = xhr.responseText; @@ -151,7 +153,7 @@ this.waiting = false; callback(null, xhr); } - }.bind(this); + }.bind(this)); this.waiting = true; xhr.send(this._seralize()); |