mirror of
https://github.com/centau/vide.git
synced 2026-08-20 23:01:37 +00:00
Merge reactive scope refactor
This commit is contained in:
parent
0e439f084f
commit
efc4798ddb
48 changed files with 2750 additions and 1949 deletions
14
src/mount.luau
Normal file
14
src/mount.luau
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
if not game then script = require "test/relative-string" end
|
||||
|
||||
local root = require(script.Parent.root)
|
||||
local apply = require(script.Parent.apply)
|
||||
|
||||
local function mount<T>(component: () -> T, target: Instance?): () -> ()
|
||||
return root(function(destroy)
|
||||
local result = component()
|
||||
if target then apply(target, { result }) end
|
||||
return destroy
|
||||
end)
|
||||
end
|
||||
|
||||
return mount :: (<T>(component: () -> T, target: Instance) -> () -> ()) & ((component: () -> ()) -> () -> ())
|
||||
Loading…
Add table
Add a link
Reference in a new issue