-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMemoryLabel.js
29 lines (29 loc) · 1.14 KB
/
MemoryLabel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var MemoryLabel = /** @class */ (function () {
function MemoryLabel(id, name) {
this.nameChangeHandlers = [];
this.id = id;
this.name = name;
this.statusli = document.createElement("li");
this.statusli.innerText = name;
this.statusli.classList.add("robotmemory");
}
MemoryLabel.prototype.getName = function () { return this.name; };
MemoryLabel.prototype.getId = function () { return this.id; };
MemoryLabel.prototype.getElement = function () { return this.statusli; };
MemoryLabel.prototype.setName = function (name) {
this.name = name;
this.nameChangeHandlers.forEach(function (handler) { handler(name); });
this.statusli.innerText = name;
};
MemoryLabel.prototype.addNameChangeHandler = function (handler) {
this.nameChangeHandlers.push(handler);
};
MemoryLabel.prototype.removeNameChangeHandler = function (handler) {
var index = this.nameChangeHandlers.indexOf(handler);
if (index >= 0) {
this.nameChangeHandlers.splice(index, 1);
}
};
return MemoryLabel;
}());
//# sourceMappingURL=MemoryLabel.js.map