feat: add reactive()

This commit is contained in:
littensy 2025-11-18 20:39:37 -08:00
parent 7bad215560
commit bd23d54374
26 changed files with 1129 additions and 569 deletions

View file

@ -1,11 +1,13 @@
local Charm = require("./Charm")
local Vide = require("./Vide")
--- Returns a reactive source that subscribes to the current value of the given
--- signal or getter function.
---
--- @param getter The getter function to subscribe to.
--- @return The reactive source.
--[[
Returns a reactive source that subscribes to the current value of the given
signal or getter function.
@param getter The getter function to subscribe to.
@return The reactive source.
]]
local function useSignalState<State>(getter: () -> State): () -> State
local state = Vide.source(getter())