mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Fix typos in creation docs
This commit is contained in:
parent
4b877ce8ff
commit
0e8bfef905
1 changed files with 19 additions and 16 deletions
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
## mount()
|
## mount()
|
||||||
|
|
||||||
Runs a function and applies its result to a target instance.
|
Runs a function in a new reactive scope and optionally applies its result to a
|
||||||
|
target instance.
|
||||||
|
|
||||||
- **Type**
|
- **Type**
|
||||||
|
|
||||||
|
|
@ -14,7 +15,7 @@ Runs a function and applies its result to a target instance.
|
||||||
|
|
||||||
- **Details**
|
- **Details**
|
||||||
|
|
||||||
The result of the function is applies to the target in the same way
|
The result of the function is applied to a target in the same way
|
||||||
properties are using `create()`.
|
properties are using `create()`.
|
||||||
|
|
||||||
The function is ran in a new reactive scope, just like
|
The function is ran in a new reactive scope, just like
|
||||||
|
|
@ -60,19 +61,16 @@ Creates a new UI element, applying any given properties.
|
||||||
|
|
||||||
- **Property setting rules**
|
- **Property setting rules**
|
||||||
|
|
||||||
- If a table index is a string:
|
- **index is string:**
|
||||||
- If its value is a function then it will either bind that property to
|
- **value is function:**
|
||||||
the function or connect it if the property type is a `RBXScriptSignal`.
|
- **property is event:** connect function as callback
|
||||||
- If the value is not a function then the property will be set to that
|
- **property is not event:** create effect to update property
|
||||||
value.
|
- **value is not function:** set property to value
|
||||||
- If a table index is a number:
|
- **index is number:**
|
||||||
- If its value is an action then that action will be queued to run after
|
- **value is action:** run action
|
||||||
properties are set.
|
- **value is table:** recurse table
|
||||||
- If its value is a table then that table will be recursively
|
- **value is functon:** create effect to update children
|
||||||
processed just like the outer table.
|
- **value is instance:** set instance as child
|
||||||
- If its value is a function then it will bind the instances children to
|
|
||||||
that function.
|
|
||||||
- If its value is an instance then it will be parented to the instance.
|
|
||||||
|
|
||||||
- **Example**
|
- **Example**
|
||||||
|
|
||||||
|
|
@ -138,9 +136,14 @@ instances.
|
||||||
```lua
|
```lua
|
||||||
local function changed(property: string, callback: (new) -> ())
|
local function changed(property: string, callback: (new) -> ())
|
||||||
return action(function(instance)
|
return action(function(instance)
|
||||||
instance:GetPropertyChangedSignal("property"):Connect(function()
|
local con - instance:GetPropertyChangedSignal(property):Connect(function()
|
||||||
callback(instance[property])
|
callback(instance[property])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- disconnect on reactive scope destruction to allow gc of instance
|
||||||
|
cleanup(function()
|
||||||
|
con:Disconnect()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue