Last active
September 23, 2023 13:56
-
-
Save al6x/501c12fa9053b425aad276fe422acf6b 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
render = (lines) -> | |
@button -> | |
@text "Say hello!" | |
@onclick (e) -> | |
lines.add "Hello simulated universe" | |
for x in lines | |
@div -> | |
@text x | |
# impl | |
p = console.log.bind console | |
builder = | |
button: (fn) -> | |
p '<button>' | |
fn.call builder | |
p '</button>' | |
div: (fn) -> | |
p '<div>' | |
fn.call builder | |
p '</div>' | |
text: (text) -> | |
p text | |
onclick: (fn) -> | |
p 'onclick=fn' | |
render.call builder, ['line1'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment