Skip to content

API Weave

kimja edited this page Jul 31, 2026 · 1 revision

🧬 API β€Ί Weave

🧬 Weave - subscriber

πŸ“œ Final subscriber - fishes whatever it needs from the river and weaves it into what it needs to fill its life's purpose.

Use for final effects: rendering, audio, persistence, etc. Other publishing/transforming rzeka methods will already work on their own even if the final .Weave() subscriber is not active yet.

Single stream:

Q += rzeka.Weave<PlayerDied>(
    this,
    deaths => deaths.Subscribe(e => ShowDeathScreen(e.Cause))
);

Two streams - react when both have values:

Q += rzeka.Weave<EquipmentChanged, PlayerStats>(
    this,
    (equipment, stats) => equipment.WithLatestFromMatter(stats)
        .Subscribe(t => UpdateEquipmentUI(t.Item1, t.Item2))
);

Raw observer:

Q += rzeka.Weave<GameClockTick>(this, _clockDisplayObserver);

_clockDisplayObserver is anything that implements IObserver<GameClockTick>:

class ClockDisplayObserver : IObserver<GameClockTick>
{
    readonly ClockDisplay _display;
    public ClockDisplayObserver(ClockDisplay display) => _display = display;

    public void OnNext(GameClockTick tick) => _display.Update(tick);
    public void OnError(Exception _) { }
    public void OnCompleted() { }
}

See also: Loom · Scry · Error Boundary · 🧬 API overview

Clone this wiki locally