Skip to content

Instantly share code, notes, and snippets.

@al6x
Last active September 23, 2023 13:56
Show Gist options
  • Save al6x/501c12fa9053b425aad276fe422acf6b to your computer and use it in GitHub Desktop.
Save al6x/501c12fa9053b425aad276fe422acf6b to your computer and use it in GitHub Desktop.
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