radio/libjs/wController/localModel.js

35 lines
893 B
JavaScript
Raw Normal View History

2018-08-04 21:46:25 +00:00
"use strict";
var counter = 0;
var Subscribable = require("../utils/subscribable");
var LocalModel = Subscribable.inherit({
"className": "LocalModel",
2018-10-28 21:32:44 +00:00
"constructor": function(properties, data) {
2018-08-04 21:46:25 +00:00
Subscribable.fn.constructor.call(this);
this.properties = [];
this._controllers = [];
if (properties) {
for (var key in properties) {
if (properties.hasOwnProperty(key)) {
var pair = {p: key, k: properties[key]};
this.properties.push(pair);
}
}
}
2018-10-28 21:32:44 +00:00
if (data !== undefined) {
this.data = data;
this.initialized = true;
}
2018-08-04 21:46:25 +00:00
},
"setData": function(data) {
this.data = data;
this.initialized = true;
2018-08-04 21:46:25 +00:00
this.trigger("data");
}
});
module.exports = LocalModel;