mirror of
https://github.com/littensy/charm.git
synced 2026-10-21 11:44:08 +00:00
refactor: remove pnpm, fix tests
This commit is contained in:
parent
861ee5acd7
commit
e34b0c9aca
65 changed files with 353 additions and 2458 deletions
|
|
@ -1,25 +0,0 @@
|
|||
local Charm = require(script.Parent.Charm)
|
||||
local Vide = if script.Parent:FindFirstChild("vide")
|
||||
then require((script :: any).Parent.vide.src) :: never
|
||||
else require(script.Parent.Vide)
|
||||
|
||||
local subscribe = Charm.subscribe
|
||||
local source = Vide.source
|
||||
local cleanup = Vide.cleanup
|
||||
|
||||
--[=[
|
||||
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 = source(callback())
|
||||
local dispose = subscribe(callback, state)
|
||||
cleanup(dispose)
|
||||
return state
|
||||
end
|
||||
|
||||
return {
|
||||
useAtom = useAtom,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue