build: create project files for release

This commit is contained in:
littensy 2025-03-09 15:29:16 -07:00
parent aff5f768bf
commit b9d32ba4f2
13 changed files with 87 additions and 72 deletions

View file

@ -0,0 +1,25 @@
local Charm = require(script.Parent.Parent.charm)
local Vide = if script.Parent.Parent:FindFirstChild("Vide")
then require(script.Parent.Parent.Vide)
else require((script.Parent.Parent :: any).vide.src) :: never
--[=[
Subscribes to the state of an atom and returns a Vide source.
@param callback The atom or selector to subscribe to.
@return The reactive source.
]=]
local function useAtom<State>(callback: () -> State): () -> State
local state = Vide.source(callback())
local unsubscribe = Charm.subscribe(callback, function(value)
task.spawn(state :: (State) -> State, value)
end)
Vide.cleanup(unsubscribe)
return state
end
return {
useAtom = useAtom,
}