Created
September 26, 2019 21:19
-
-
Save vertcitron/7905837e93b36dbc92bed9e50d8e609a 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 TextFieldButton from "./components/TextFieldButton" | |
import Viewer from "./components/Viewer" | |
const appElement = document.getElementById('app') | |
const instantViewer = new Viewer() | |
instantViewer.label = 'I react to input events:' | |
const validatedViewer = new Viewer() | |
validatedViewer.label = 'I react to change events:' | |
const textFieldBtn = new TextFieldButton() | |
textFieldBtn.placeholder = 'Enter text here...' | |
textFieldBtn.value = '' | |
textFieldBtn.onInput = (value: string) => { | |
instantViewer.content = value | |
} | |
textFieldBtn.onChange = (value: string) => { | |
validatedViewer.content = value | |
} | |
function renderApp() { | |
if (appElement !== null) { | |
appElement.innerHTML = '' | |
textFieldBtn.render(appElement) | |
instantViewer.render(appElement) | |
validatedViewer.render(appElement) | |
} | |
} | |
renderApp() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment