acha-framework
Version:
is a modular framework on both client (angular.js) and server (node.js) side, it provides security, orm, ioc, obfuscation and ...
29 lines • 818 B
JavaScript
(function (undefined) {
Ioc.define('backend.operationResult', [], function (provide) {
const OperationResult = function () {
this.error = null;
this.status = false;
this.data = null;
};
OperationResult.success = function (data) {
return new OperationResult().success(data);
};
OperationResult.failed = function (error) {
return new OperationResult().failed(error);
};
OperationResult.prototype.success = function (data) {
this.data = data;
this.status = true;
this.error = null;
return this;
};
OperationResult.prototype.failed = function (error) {
this.data = null;
this.status = false;
this.error = error;
return this;
};
OperationResult.Errors = {};
provide(OperationResult);
});
}());