Add 'output: field1, field2' syntax to stream declarations to control
which signals are exposed over the relay. Only listed signals are
registered in _signalRegistry (and thus streamed). Omitting output
streams all signals (backwards-compatible).
Also strips internal sync metadata (_pid, _v) from receiver state
so composition consumers only see clean signal values.
Parser: parse comma-separated idents after 'output:' key
AST: Vec<String> output field on StreamDecl
Codegen: conditional _registerSignal, delete _pid/_v on receive
Example: stream counter on 'ws://...' { mode: signal, output: count, doubled }
26 lines
607 B
Text
26 lines
607 B
Text
-- 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, output: count, doubled }
|
|
|
|
view counter =
|
|
column [
|
|
text message
|
|
text count
|
|
text doubled
|
|
row [
|
|
button "-" { click: count -= 1 }
|
|
button "+" { click: count += 1 }
|
|
]
|
|
when count > 10 ->
|
|
text "On fire!"
|
|
]
|