Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

Commit

Permalink
Merge pull request #21 from metal/release/v3.1.0
Browse files Browse the repository at this point in the history
3.1.0
  • Loading branch information
jbalsas authored Nov 2, 2017
2 parents 885c81c + 8e25623 commit 7d25860
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 65 deletions.
5 changes: 0 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ var options = {
browserName: 'chrome',
version: '57'
},
sl_safari_8: {
base: 'SauceLabs',
browserName: 'safari',
version: '8'
},
sl_safari_9: {
base: 'SauceLabs',
browserName: 'safari',
Expand Down
14 changes: 14 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

module.exports = function(config) {
config.set({
customHeaders: [
{
match: 'test/data/data.json',
name: 'Content-Length',
value: 315186
}
],

frameworks: ['browserify', 'chai', 'mocha', 'sinon'],

files: [
Expand All @@ -10,6 +18,12 @@ module.exports = function(config) {
watched: false,
included: true,
served: true
},
{
pattern: 'test/data/data.json',
watched: false,
included: false,
served: true
}
],

Expand Down
119 changes: 64 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"dependencies": {
"metal": "^2.0.0",
"metal-promise": "^2.0.0",
"metal-promise": "^3.0.3",
"metal-uri": "^3.0.0"
},
"devDependencies": {
Expand All @@ -38,6 +38,7 @@
"gulp-metal": "^2.2.2",
"karma": "^1.7.1",
"karma-browserify": "^5.1.1",
"metal-structs": "^1.0.0"
"metal-structs": "^1.0.0",
"metal-useragent": "^2.1.3"
}
}
11 changes: 8 additions & 3 deletions src/Ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { isDef, isDefAndNotNull } from 'metal';
import Uri from 'metal-uri';
import { CancellablePromise as Promise } from 'metal-promise';
import { ProgressPromise as Promise } from 'metal-promise';

class Ajax {

Expand Down Expand Up @@ -55,14 +55,19 @@ class Ajax {
var request = new XMLHttpRequest();
var previousReadyState = 0;

var promise = new Promise(function(resolve, reject) {
var promise = new Promise(function(resolve, reject, progress) {
request.onload = function() {
if (request.aborted) {
request.onerror();
return;
}
resolve(request);
};
request.onprogress = function(progressEvent) {
if (progressEvent.lengthComputable) {
progress(progressEvent.loaded / progressEvent.total);
}
};
request.onreadystatechange = function() {
if (previousReadyState && previousReadyState < 3 && 4 === request.readyState) {
request.terminatedPrematurely = true;
Expand All @@ -73,7 +78,7 @@ class Ajax {
var message = 'Request error';
if (request.terminatedPrematurely) {
message = 'Request terminated prematurely';
}
}
var error = new Error(message);
error.request = request;
reject(error);
Expand Down
Loading

0 comments on commit 7d25860

Please sign in to comment.