Skip to content

Instantly share code, notes, and snippets.

@vertcitron
Created September 25, 2019 12:39
Show Gist options
  • Save vertcitron/128774cbb0bb36b01a4c6406a7d4c73d to your computer and use it in GitHub Desktop.
Save vertcitron/128774cbb0bb36b01a4c6406a7d4c73d to your computer and use it in GitHub Desktop.
import Button from "./components/Button"
const appElement = document.getElementById('app')
const alertButton = new Button('Alert Button')
alertButton.onClick = () => {
alert('Alert button was clicked !')
}
const warningButton = new Button('Warning Button')
warningButton.onClick = () => {
console.warn('Warning button was clicked !')
}
function renderApp() {
if (appElement !== null) {
appElement.innerHTML = ''
alertButton.render(appElement)
warningButton.render(appElement)
}
}
renderApp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment