Skip to content

Commit

Permalink
Merge pull request #42 from ykzts/fix-issue-40
Browse files Browse the repository at this point in the history
Fix #40
  • Loading branch information
ykzts authored Nov 13, 2016
2 parents 8bc6dc7 + 7d2fa85 commit d1fcba1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/xmlhttprequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ function _receiveResponse(response) {
}

function _setDispatchProgressEvents(stream) {
const _properties = this._properties;
const _properties = this._properties || {};
const loadStartEvent = new ProgressEvent('loadstart');
this.dispatchEvent(loadStartEvent);
stream.on('data', () => {
const progressEvent = new ProgressEvent('progress', {
lengthComputable: _properties.lengthComputable,
loaded: _properties.loaded,
total: _properties.total
lengthComputable: _properties.lengthComputable || 0,
loaded: _properties.loaded || 0,
total: _properties.total || 0
});
this.dispatchEvent(progressEvent);
});
Expand Down

0 comments on commit d1fcba1

Please sign in to comment.