mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 21:28:12 +00:00
[API] Begin adding View
This commit is contained in:
20
src/api/View.js
Normal file
20
src/api/View.js
Normal file
@ -0,0 +1,20 @@
|
||||
define(['EventEmitter'], function (EventEmitter) {
|
||||
function View() {
|
||||
EventEmitter.call(this);
|
||||
this.state = { elements: [], model: undefined };
|
||||
}
|
||||
|
||||
View.prototype = Object.create(EventEmitter.prototype);
|
||||
|
||||
['elements', 'model'].forEach(function (method) {
|
||||
View.prototype[method] = function (value) {
|
||||
if (arguments.length > 0) {
|
||||
this.state[method] = value;
|
||||
this.emit(method, value);
|
||||
}
|
||||
return this.state[method];
|
||||
}
|
||||
});
|
||||
|
||||
return View;
|
||||
});
|
Reference in New Issue
Block a user