24 lines
487 B
JavaScript
24 lines
487 B
JavaScript
|
export class DisplayValue {
|
||
|
constructor(name, box) {
|
||
|
this.value = undefined;
|
||
|
this.name = name;
|
||
|
this.box = box;
|
||
|
this.nameBox = this.box.addBox(`${this.name}-name`).addClass('name');
|
||
|
this.valueBox = this.box.addBox(`${this.name}-value`).addClass('value');
|
||
|
this.nameBox.setInnerHTML(this.name);
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
this.valueBox.setInnerHTML(this.value);
|
||
|
}
|
||
|
|
||
|
set(value) {
|
||
|
this.value = value;
|
||
|
this.render();
|
||
|
}
|
||
|
|
||
|
get() {
|
||
|
return this.value;
|
||
|
}
|
||
|
}
|