dresscode-bricks
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -45,12 +45,10 @@ Bricks.Remote = Bricks.Component.inherit({ | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState == 4) { | ||
if (xhr.readyState === 4) { | ||
xhr.onreadystatechange = null; | ||
if (xhr.status == 200) { | ||
callback.call(ctx, that._parseResponse(xhr), xhr); | ||
} else { | ||
callback.call(ctx, null, xhr); | ||
if (callback) { | ||
callback.call(ctx, xhr.status === 200 ? that._parseResponse(xhr) : null, xhr); | ||
} | ||
} | ||
}; | ||
if (method == 'POST' || method == 'PUT') { | ||
if (method === 'POST' || method === 'PUT') { | ||
xhr.setRequestHeader('Content-Type', this.contentType); | ||
@@ -74,3 +72,3 @@ xhr.send(this._encodePostParams(postParams)); | ||
var contentType = xhr.getResponseHeader('Content-Type') || ''; | ||
if (contentType.indexOf('application/json') == 0) { | ||
if (contentType.indexOf('application/json') === 0) { | ||
return Bricks.JSON.parse(xhr.responseText, function(k, v) { | ||
@@ -77,0 +75,0 @@ return typeof v == 'string' && /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\dZ$/.test(v) ? new Date(v) : v; |
{ | ||
"name": "dresscode-bricks", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Kolyaj", |
126102
2985