From be811662bf2b7e15a4c96d8353f36862d1fabeea Mon Sep 17 00:00:00 2001 From: enzotar Date: Wed, 25 Feb 2026 14:34:41 -0800 Subject: [PATCH] =?UTF-8?q?feat(examples):=20add=20streaming=20.ds=20examp?= =?UTF-8?q?les=20=E2=80=94=20compiler-native=20streaming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - streaming-counter.ds: reactive counter with 'stream counter on ws://...' - streaming-receiver.ds: remote receiver with 'stream from ws://...' - E2E verified: compiles to streaming JS, connects to relay, sends signal diffs --- examples/streaming-counter.ds | 26 ++++++++++++++++++++++++++ examples/streaming-receiver.ds | 15 +++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 examples/streaming-counter.ds create mode 100644 examples/streaming-receiver.ds diff --git a/examples/streaming-counter.ds b/examples/streaming-counter.ds new file mode 100644 index 0000000..a1c65c8 --- /dev/null +++ b/examples/streaming-counter.ds @@ -0,0 +1,26 @@ +-- DreamStack Streaming Counter +-- A reactive counter that streams all signal changes +-- to remote receivers via the bitstream relay. +-- +-- Run with: +-- cargo run -p ds-stream & +-- dreamstack stream examples/streaming-counter.ds + +let count = 0 +let doubled = count * 2 +let message = "Streaming Counter" + +stream counter on "ws://localhost:9100" { mode: signal } + +view counter = + column [ + text message + text count + text doubled + row [ + button "-" { click: count -= 1 } + button "+" { click: count += 1 } + ] + when count > 10 -> + text "On fire!" + ] diff --git a/examples/streaming-receiver.ds b/examples/streaming-receiver.ds new file mode 100644 index 0000000..a07bfb2 --- /dev/null +++ b/examples/streaming-receiver.ds @@ -0,0 +1,15 @@ +-- DreamStack Streaming Receiver +-- Connects to a remote stream and renders the received signal state. +-- +-- Run with: +-- (source must be running first) +-- dreamstack dev examples/streaming-receiver.ds --port 3001 + +let remote = stream from "ws://localhost:9100" + +view main = + column [ + text "📡 Remote Stream" + text "Count: {remote.count}" + text "Doubled: {remote.doubled}" + ]