Packages/mootools-ext/Source/Request/Request.Statuses.js in lsd_rails-0.1.2 vs Packages/mootools-ext/Source/Request/Request.Statuses.js in lsd_rails-0.1.3
- old
+ new
@@ -28,11 +28,11 @@
This monkey patch ensures your json is
parsed (and html applied) even if the status
is "non successful" (anything but 2xx).
*/
-(function(isSuccess, onSuccess) {
+(function(onSuccess) {
var Statuses = Request.Statuses = {
200: 'Ok',
201: 'Created',
202: 'Accepted',
@@ -73,23 +73,25 @@
507: "InsufficientStorage",
509: "BandwidthLimitExceeded",
510: "NotExtended"
};
-Object.append(Request.prototype, {
- isSuccess: function() {
- return true;
+Object.merge(Request.prototype, {
+ options: {
+ isSuccess: function() {
+ return true;
+ }
},
onSuccess: function() {
+ if (this.isSuccess()) this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain.apply(this, arguments);
+ else this.onFailure.apply(this, arguments);
var status = Request.Statuses[this.status];
if (status) this.fireEvent('on' + status, arguments)
- if (isSuccess.call(this)) this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain.apply(this, arguments);
- else this.onFailure.apply(this, arguments);
},
onFailure: function(){
this.fireEvent('complete', arguments).fireEvent('failure', arguments);
}
});
-})(Request.prototype.isSuccess, Request.prototype.onSuccess);
+})(Request.prototype.onSuccess);
\ No newline at end of file