Closed estrattonbailey closed 8 years ago
Yeah after thinking about this I learn towards no JSONp support. Easy enough to use a third-party standalone JSONp lib and not muddy up yours ✌🏼
@estrattonbailey Sorry I never saw this til now...
As for JSONP, it is supported in this lib, but not without a tiny bit of work.
ajax('somewhere?callback=foo', function (code, body) {
var bodyJson = body.replace(/^foo\(/,'').replace(/\)$/,'')
, bodyObj = JSON.parse(bodyJson)
...
})
This kind of flow is exactly how I feel about nanoajax. It works at <1K, but you pay a price for that in your code (but not too much, or you'd be better off using jquery).
As for ES6, I'd like to keep compilation out of the lib as long as possible. I don't want to force people to use a certain toolchain in order to use nanoajax. With that said, if it lowers the byte count by a significant amount (say 10%), I'd be up for it.
Hey! Thanks for the lib, handy little thing.
Have you considered adding JSONp support? I realize that adding it is kinda outside the bounds of this project, since it's not technically part of XHR, but thought I would ask since for most users direct integration with with their callbacks would be ideal.
Happy to submit a pull request too, if you'd consider reviewing.
Cheers!
P.S. Any thoughts on an ES6 rewrite of source + compiled export for backwards compat?