Created
September 26, 2019 21:05
-
-
Save vertcitron/376dd90eea64cb9bac4a2514f0b60558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from './Component' | |
export default class Viewer extends Component { | |
readonly element: HTMLDivElement | |
private _label: string = '' | |
private _content: string = '' | |
constructor () { | |
super() | |
this.element = document.createElement('div') | |
this.element.className = 'viewer' | |
} | |
get label (): string { | |
return this._label | |
} | |
set label (value: string) { | |
this._label = value | |
this.update() | |
} | |
get content (): string { | |
return this._content | |
} | |
set content (value: string) { | |
this._content = value | |
this.update() | |
} | |
update () { | |
this.element.innerHTML = ` | |
<label>${this._label}</label> | |
<p>${this._content}</p> | |
` | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment