mirror of
https://github.com/centau/vide.git
synced 2026-08-20 23:01:37 +00:00
This commit is contained in:
parent
866135b152
commit
e776183452
10 changed files with 480 additions and 367 deletions
|
|
@ -2,7 +2,6 @@ if not game then script = require "test/relative-string" end
|
|||
|
||||
local graph = require(script.Parent.graph)
|
||||
local create_node = graph.create_node
|
||||
local capture_parents = graph.capture_parents
|
||||
local add_child = graph.add_child
|
||||
local update = graph.update
|
||||
local track = graph.track
|
||||
|
|
@ -11,17 +10,19 @@ local open_scope = graph.open_scope
|
|||
local close_scope = graph.close_scope
|
||||
|
||||
local function derive<T>(fn: () -> T): () -> T
|
||||
assert(get_scope())
|
||||
local owner = get_scope()
|
||||
assert(owner)
|
||||
|
||||
local node = create_node((false :: any) :: T)
|
||||
node.effect = function()
|
||||
node.cache = fn()
|
||||
update(node)
|
||||
end
|
||||
|
||||
open_scope(node.scope)
|
||||
add_child(owner, node)
|
||||
|
||||
node.cache = capture_parents(node, fn)
|
||||
open_scope(node)
|
||||
|
||||
node.cache = fn()
|
||||
|
||||
close_scope()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue