David Herman

07/18/2023, 12:11 AM
🕸️ Latest Kobweb releases... 0.13.9 is a fun one! 🕸️ 0.13.8 Pre-0.13.8, the logic for SimpleGrid was hardcoded in a way that columns maxed out at 6. However, with the power of CSS variables, the number of columns is now only bounded by your imagination. 🌈
Copy code
SimpleGrid(numColumns(10)) {
    repeat(30) {
(See attached image) 0.13.9 The latest release introduces persistent client-server connections (think WebSockets) via a feature called API streams (a new companion to API routes, the way you declare REST endpoints in Kobweb) Declaring and using streams will likely be a little more involved in practice, but for the simple case of just sending text back and forth, you're looking at some nice one-liners. Here, the following code sends text to the server which then immediately gets echoed back to the client (and logged to the console):
Copy code
// Backend
val echo = ApiStream { ctx -> }

// Frontend
val echoStream = rememberApiStream("echo") { ctx -> console.log("Echoed: ${ctx.text}") }
// later:
A Kobweb power-user put together a chess playground is less than two days (see attached video). Tons of potential in this feature! Hope the community has fun with it.
🌈 1
😍 5