dao-governance-framework/forum-network/public/classes/display-value.js

24 lines
487 B
JavaScript
Raw Normal View History

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;
}
}