mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
This commit is contained in:
parent
dcc40b4dc1
commit
52ea2e4690
9 changed files with 147 additions and 102 deletions
|
|
@ -11,6 +11,8 @@ local close_scope = graph.close_scope
|
|||
local get_scope = graph.get_scope
|
||||
local destroy = graph.destroy
|
||||
|
||||
local refs = {}
|
||||
|
||||
local function root<T>(fn: () -> T): (T, () -> ())
|
||||
--assert(not get_scope())
|
||||
local node = create_node(false)
|
||||
|
|
@ -21,7 +23,10 @@ local function root<T>(fn: () -> T): (T, () -> ())
|
|||
|
||||
close_scope()
|
||||
|
||||
refs[node] = true
|
||||
|
||||
return v, function()
|
||||
refs[node] = nil
|
||||
destroy(node)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue