Comparing version 0.1.2 to 0.1.3
@@ -21,4 +21,2 @@ function Alite(XMLHttpRequest) { | ||
this.xhr = req; | ||
req.onreadystatechange = function () { | ||
@@ -25,0 +23,0 @@ if (req.readyState == 4) { |
@@ -1,2 +0,2 @@ | ||
function Alite(t){function e(t){var e=t&&t.responseText,a=e&&("{"==e[0]||"["==e[0]);return a?JSON.parse(e):e}t=t||this.XMLHttpRequest;var a={ajaxStart:function(){},ajaxStop:function(){},ajax:function(n){return new Promise(function(r,o){var s=new t,u=n.raw?n.data:n.data?JSON.stringify(n.data):void 0;if(this.xhr=s,s.onreadystatechange=function(){4==s.readyState&&(s.status>=200&&s.status<300?r(e(s)):o(e(s)),a.ajaxStop(s,n))},s.open(n.method,n.url),!n.raw&&s.setRequestHeader("content-type","application/json"),n.headers)for(var i in n.headers)s.setRequestHeader(i,n.headers[i]);a.ajaxStart(s,n),n.ajaxStart&&n.ajaxStart(s),s.send(u)})}};return["put","post","patch","get","delete"].forEach(function(t){a[t]=function(e){return e.method=t,this.ajax(e)}}),a}"undefined"!=typeof module&&module.exports&&(module.exports=Alite); | ||
function Alite(t){function e(t){var e=t&&t.responseText,a=e&&("{"==e[0]||"["==e[0]);return a?JSON.parse(e):e}t=t||this.XMLHttpRequest;var a={ajaxStart:function(){},ajaxStop:function(){},ajax:function(n){return new Promise(function(r,o){var s=new t,u=n.raw?n.data:n.data?JSON.stringify(n.data):void 0;if(s.onreadystatechange=function(){4==s.readyState&&(s.status>=200&&s.status<300?r(e(s)):o(e(s)),a.ajaxStop(s,n))},s.open(n.method,n.url),!n.raw&&s.setRequestHeader("content-type","application/json"),n.headers)for(var i in n.headers)s.setRequestHeader(i,n.headers[i]);a.ajaxStart(s,n),n.ajaxStart&&n.ajaxStart(s),s.send(u)})}};return["put","post","patch","get","delete"].forEach(function(t){a[t]=function(e){return e.method=t,this.ajax(e)}}),a}"undefined"!=typeof module&&module.exports&&(module.exports=Alite); | ||
//# sourceMappingURL=alite.min.js.map |
{ | ||
"name": "alite", | ||
"main": "alite.js", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/chrisdavies/alite", | ||
@@ -6,0 +6,0 @@ "authors": [ |
{ | ||
"name": "alite", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Tiny ajax helper", | ||
@@ -5,0 +5,0 @@ "main": "alite.js", |
Sorry, the diff of this file is not supported yet
10772
74