So given it’s Saturday night, I thought I’d have a little fun with Kitten and make a tiny collaborative drawing toy.
You have a 20×20 grid and only black and white to draw with and everyone shares the same canvas.
https://draw-together.small-web.org
Have fun + looking forward to seeing what we all, umm, draw together.
PS. It took about 60 lines of code.
View source: https://codeberg.org/aral/draw-together
@aral@mastodon.ar.al where does the "pixel" event on line 12 get emitted from?
@scott It gets emitted from each of the buttons, all of which have the same name attribute (`pixel`).
In Kitten’s Streaming HTML workflow, element names are mapped to events on the server (when either the default event type – in this case `click` – or a custom event you specify gets fired). Under the hood, it’s htmx + WebSocket + some Kitten magic (auto-generated WebSocket route, syntactic sugar, etc.)
I have a whole write up that peels away the magic here: