Skip to content

Instantly share code, notes, and snippets.

@vertcitron
Created September 26, 2019 21:05
Show Gist options
  • Save vertcitron/376dd90eea64cb9bac4a2514f0b60558 to your computer and use it in GitHub Desktop.
Save vertcitron/376dd90eea64cb9bac4a2514f0b60558 to your computer and use it in GitHub Desktop.
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