metal-ajax
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -80,2 +80,3 @@ 'use strict'; | ||
var request = new XMLHttpRequest(); | ||
var previousReadyState = 0; | ||
@@ -90,4 +91,14 @@ var promise = new _metalPromise.CancellablePromise(function (resolve, reject) { | ||
}; | ||
request.onreadystatechange = function () { | ||
if (previousReadyState && previousReadyState < 3 && 4 === request.readyState) { | ||
request.terminatedPrematurely = true; | ||
} | ||
previousReadyState = request.readyState; | ||
}; | ||
request.onerror = function () { | ||
var error = new Error('Request error'); | ||
var message = 'Request error'; | ||
if (request.terminatedPrematurely) { | ||
message = 'Request terminated prematurely'; | ||
} | ||
var error = new Error(message); | ||
error.request = request; | ||
@@ -94,0 +105,0 @@ reject(error); |
{ | ||
"name": "metal-ajax", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Metal.js utility to perform Ajax requests", | ||
@@ -35,5 +35,5 @@ "license": "BSD", | ||
"gulp": "^3.8.11", | ||
"gulp-metal": "^1.0.0", | ||
"gulp-metal": "^2.0.0", | ||
"metal-structs": "^1.0.0" | ||
} | ||
} |
# metal-ajax | ||
[![Build Status](https://travis-ci.org/metal/metal-ajax.svg?branch=master)](https://travis-ci.org/metal/metal-ajax) | ||
[![Build Status](https://saucelabs.com/browser-matrix/metal-ajax.svg)](https://saucelabs.com/beta/builds/ff7b6c3bec2e49cd80c02db948bc88ce) | ||
Metal.js utility to perform Ajax requests | ||
@@ -4,0 +8,0 @@ |
@@ -56,2 +56,3 @@ 'use strict'; | ||
var request = new XMLHttpRequest(); | ||
var previousReadyState = 0; | ||
@@ -66,4 +67,14 @@ var promise = new Promise(function(resolve, reject) { | ||
}; | ||
request.onreadystatechange = function() { | ||
if (previousReadyState && previousReadyState < 3 && 4 === request.readyState) { | ||
request.terminatedPrematurely = true; | ||
} | ||
previousReadyState = request.readyState; | ||
}; | ||
request.onerror = function() { | ||
var error = new Error('Request error'); | ||
var message = 'Request error'; | ||
if (request.terminatedPrematurely) { | ||
message = 'Request terminated prematurely'; | ||
} | ||
var error = new Error(message); | ||
error.request = request; | ||
@@ -70,0 +81,0 @@ reject(error); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
15776
396
30