Skip to content

Instantly share code, notes, and snippets.

@rmorshea
Last active November 7, 2018 16:32
Show Gist options
  • Save rmorshea/35d7d76442da68503b88fb9b37cc099d to your computer and use it in GitHub Desktop.
Save rmorshea/35d7d76442da68503b88fb9b37cc099d to your computer and use it in GitHub Desktop.
from the_library import mount, element
from vdom.helpers import p, div
@element
# it'd be possible to leverage asyncio
async def hello(who):
return p(f"hello {who}")
@hello.updated
def hello(old, new):
print(f"it updated from {old} to {new}")
@element
def greeting():
h = hello("world")
biggerGreeting = lambda event : h.who("universe")
return div(h, onClick=biggerGreeting)
mount("ws://websocket-stuff", greeting())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment