mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
14 lines
489 B
Lua
14 lines
489 B
Lua
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: () -> ()) -> () -> ())
|