Closed jenstornell closed 9 years ago
In case you do not update it anymore, here is an unminified version:
! function(e, t) {
function n() {
if (t.XMLHttpRequest) return new t.XMLHttpRequest;
try {
return new t.ActiveXObject("MSXML2.XMLHTTP.3.0")
} catch (e) {}
throw new Error("no xmlhttp request able to be created")
}
function r(e, t, n) {
e[t] = e[t] || n
}
t.nanoajax = e, e.ajax = function(e, t) {
"string" == typeof e && (e = {
url: e
});
var a = e.headers || {}, o = e.body,
u = e.method || (o ? "POST" : "GET"),
i = e.withCredentials || !1,
s = n();
s.onreadystatechange = function() {
4 == s.readyState && t(s.status, s.responseText, s)
}, o && (r(a, "X-Requested-With", "XMLHttpRequest"), r(a, "Content-Type", "application/x-www-form-urlencoded")), s.open(u, e.url, !0), s.withCredentials = i;
for (var c in a) s.setRequestHeader(c, a[c]);
s.send(o)
}
}({}, function() {
return this
}());
Have a look at index.js
I searched for nanoajax
in index.js
but it could not be found so I guess it does not work?
Well, if you look at the make
file, the minifier wraps index.js
with nanoajax
, so I guess you can wrap it yourself, naming it however you like.
@jenstornell index.js is the unminified version you are looking for. It is written as a CommonJS module, which is compatible with many tools, notably browserify.
In make, we call uglifyjs
with the --wrap nanoajax
argument, which wraps our CommonJS module in one large function and assigns exports
to window.nanoajax
.
To use this package, you can do a few things:
npm install nanoajax
, and var nanoajax = require('nanoajax')
nanoajax.min.js
) to your HTML as a <script>
tagnanoajax.min.js
) to one large JS file in your toolchain. Re-minifying later has no negative effects, so there should be no need to have an unminified file.If this solves your problem, go ahead and close the issue.
Please reopen if you have further issues.
This works great! However there seems to be a
nanoajax.min.js
but nonanoajax.js
?I prefer compressing the js files myself when merging the js to one compact file.