Define setter and getter
An example showing how to define object's setter and getter on your device with Tizen 2.3.
var Class = function() {
this._values = {};
};
Class.prototype.get = function(attr) {
return this._values[attr];
};
Class.prototype.set = function(attr, val) {
return this._values[attr] = val;
};
Object.defineProperty(Class.prototype, 'name', {
get: function() {
return this.get('name');
},
set: function(value) {
this.set('name', value);
}
});
var obj = new Class();
obj.name = 'test';