mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
refactor(vide): simplify task.spawn call
This commit is contained in:
parent
39a5b67d9c
commit
c9755d31fd
1 changed files with 1 additions and 3 deletions
|
|
@ -12,9 +12,7 @@ local Vide = if script.Parent:FindFirstChild("vide")
|
|||
local function useAtom<State>(callback: () -> State): () -> State
|
||||
local state = Vide.source(callback())
|
||||
local unsubscribe = Charm.subscribe(callback, function(value)
|
||||
task.spawn(function()
|
||||
state(value)
|
||||
end)
|
||||
task.spawn(state :: (State) -> State, value)
|
||||
end)
|
||||
|
||||
Vide.cleanup(unsubscribe)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue