Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

revamped the ajax constructor, now merely silently fails

  • Loading branch information...
commit 10760d64821b97118c5ad3521993d0db67f5fd85 1 parent 0e0d9ee
@substack authored
Showing with 18 additions and 6 deletions.
  1. +1 −1  example/streaming/main.js
  2. +17 −4 index.js
  3. +0 −1  lib/request.js
View
2  example/streaming/main.js
@@ -2,7 +2,7 @@ var http = require('http');
http.get({ path : '/doom' }, function (res) {
var div = document.getElementById('result');
- div.innerHTML = res.statusCode + ': ';
+ div.innerHTML += res.statusCode + ': ';
if (!div.style) div.style = {};
div.style.color = 'rgb(80,80,80)';
View
21 index.js
@@ -33,10 +33,23 @@ var xhrHttp = (function () {
'Microsoft.XMLHTTP'
];
for (var i = 0; i < axs.length; i++) {
- try {
- return new(window.ActiveXObject)(axs[i]);
- }
- catch (e) {}
+ var res = (function (j) {
+ try {
+ var ax = new(window.ActiveXObject)(axs[j]);
+ return function () {
+ if (ax) {
+ var ax_ = ax;
+ ax = null;
+ return ax_;
+ }
+ else {
+ return new(window.ActiveXObject)(axs[j]);
+ }
+ };
+ }
+ catch (e) {}
+ })(i);
+ if (res) return res;
}
throw new Error('ajax not supported in this browser')
}
View
1  lib/request.js
@@ -20,7 +20,6 @@ var Request = module.exports = function (xhr, params) {
});
}
- //xhr.multipart = params.multipart;
xhr.open(params.method || 'GET', 'http://' + uri, true);
var res = new Response;
Please sign in to comment.
Something went wrong with that request. Please try again.