c9-core/plugins/c9.ide.run.debug/data/data.js

54 wiersze
1.3 KiB
JavaScript
Czysty Zwykły widok Historia

2017-01-06 10:47:08 +00:00
/**
* Data base class for the Cloud9 Debugger.
* @class debugger.Data
*/
/**
* Retrieves an XML representation of this object.
* @property {String} xml
*/
/**
* Retrieves a json representation of thie object.
* @property {String} json
*/
/**
* Returns a string representation of this object (similar to {@link #xml})
* @method toString
* @return {String}
*/
/**
* Determines whether the passed object is logically an exact copy.
* @method equals
* @param {Object} object
*/
define(function(require, exports, module) {
function Data(props, sets, singletons) {
this.$props = props || [];
this.$sets = sets || [];
this.$single = singletons || [];
var _self = this;
this.$props.concat(this.$sets).concat(this.$single).forEach(function(prop) {
_self.__defineGetter__(prop, function() {
return this.data[prop];
});
_self.__defineSetter__(prop, function(v) {
this.data[prop] = v;
});
});
}
Data.prototype = {
get json() {
return this.data;
},
set json(v) {
this.data = v;
},
toString: function() {
2017-05-22 21:38:52 +00:00
return this.json;
2017-01-06 10:47:08 +00:00
}
};
module.exports = Data;
});