Skip to content

Instantly share code, notes, and snippets.

@hmil
Created October 17, 2019 11:01
Show Gist options
  • Save hmil/f7f741878eb8dac6da78b011c00a9f41 to your computer and use it in GitHub Desktop.
Save hmil/f7f741878eb8dac6da78b011c00a9f41 to your computer and use it in GitHub Desktop.
imperative-frontend-end
function buildUI() {
const window = createWindow();
const btn = createButton();
const label = createLabel();
let visitorNumber = 0;
label.text = `Hello visitor nr ${visitorNumber}`;
btn.label = "click me";
btn.onClick = () => {
// Update visitor label
visitorNumber = visitorNumber + 1;
label.text = `Hello visitor nr ${visitorNumber}`
};
window.append(label);
window.append(btn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment