Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansynchronous HTTP 202 support + user cancellation #34

Open
wants to merge 3 commits into
base: terriajs
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resolve consflict
  • Loading branch information
Jason-DNetto committed Jul 23, 2018
commit d22b8caaed8803402972f0d231b953b95fa224a2
15 changes: 4 additions & 11 deletions Source/Core/Resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,14 +1260,11 @@ define([
var timeout = options.timeout;
var data = options.data;
var deferred = when.defer();
<<<<<<< Updated upstream
var xhr = Resource._Implementations.loadWithXhr(resource.url, responseType, method, data, headers, deferred, overrideMimeType, timeout);
=======
var xhr = Resource._Implementations.loadWithXhr(resource.url, responseType, method, data, headers, deferred, overrideMimeType, request);
>>>>>>> Stashed changes
var xhr = Resource._Implementations.loadWithXhr(resource.url, responseType, method, data, headers, deferred, overrideMimeType, timeout, request);
if (defined(xhr) && defined(xhr.abort)) {
request.cancelFunction = function() {
xhr.abort();
request.cancel();
};
}
return deferred.promise;
Expand Down Expand Up @@ -1897,11 +1894,7 @@ define([
}).end();
}

<<<<<<< Updated upstream
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType, timeout) {
=======
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType, request) {
>>>>>>> Stashed changes
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType, timeout, request) {
var dataUriRegexResult = dataUriRegex.exec(url);
if (dataUriRegexResult !== null) {
deferred.resolve(decodeDataUri(dataUriRegexResult, responseType));
Expand Down Expand Up @@ -1992,7 +1985,7 @@ define([
var newXHR;
setTimeout(function(){
if (!request.cancelled){
newXHR = loadWithXhr.load.call(this,newURL, responseType, method, data, headers, deferred, overrideMimeType, timeout, request);
newXHR = Resource._Implementations.loadWithXhr.call(this,newURL, responseType, method, data, headers, deferred, overrideMimeType, timeout, request);
} else {
//user cancel request after waking from sleep
return;
Expand Down