Pyroxenium / Basalt

A UI Framework for CC:Tweaked
MIT License
189 stars 34 forks source link

[XML] Untracked reactive value access #74

Closed thesabinelim closed 1 year ago

thesabinelim commented 1 year ago

Allows for accessing reactive values in an unreactive way, not updating after the first access. This by itself is not very useful but it can be used as a building block for more complex behaviour.

<script>
  basalt = require("basalt")
  getCount, setCount = basalt.reactive(0)
</script>

<button text={"Times clicked: " .. getCount()}>
  <onClick>
    setCount(getCount() + 1)
  </onClick>
</button>
<label text={"This value should never update: " .. basalt.untracked(getCount)} />