Revisions
-
kidager renamed this gist
May 3, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
matthewpblog revised this gist
Jul 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function xhr(options) { } if([200,304].indexOf(req.status) === -1) { deferred.reject(new Error('Server responded with a status of ' + req.status)); } else { deferred.resolve(e.target.result); } -
matthewpblog revised this gist
Jul 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function xhr(options) { } if([200,304].indexOf(req.status) === -1) { deferred.reject(new Error('Server responded with a status of ' + req.status); } else { deferred.resolve(e.target.result); } -
matthewpblog revised this gist
Jul 12, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function xhr(options) { } }; req.send(options.data || void 0); return deferred.promise; } -
matthewpblog revised this gist
Jul 12, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ function xhr(options) { var deferred = Q.defer(), req = new XMLHttpRequest(); req.open(options.method || 'GET', options.url, true); -
matthewpblog created this gist
Jul 12, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ function xhr(options) { var deferred = Q.defer(), req = new XMLHttpRequest(); req.open(options.method || 'GET', options.url, true); // Set request headers if provided. Object.keys(options.headers || {}).forEach(function (key) { req.setRequestHeader(key, options.headers[key]); }); req.onreadystatechange = function(e) { if(req.readyState !== 4) { return; } if([200,304].indexOf(req.status) === -1) { deferred.reject(req.status); } else { deferred.resolve(e.target.result); } }; req.send(options.data); return deferred.promise; }