This commit is contained in:
James 2023-08-07 23:42:58 -04:00 committed by GitHub
commit e60803733b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 13 deletions

View file

@ -7,13 +7,13 @@ Returns a new state with a dynamically animated value of the source.
- ### Type - ### Type
```lua ```lua
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3
function spring<T>( function spring<T>(
source: () -> T & Animatable, source: () -> T & Animatable,
period: number = 1, period: number = 1,
damping_ratio: number = 1 damping_ratio: number = 1
): () -> T ): () -> T
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3
``` ```
- ### Details - ### Details

View file

@ -9,10 +9,11 @@ Creates a new UI element, applying any given properties.
- ### Type - ### Type
```lua ```lua
function create(class: string): (Properties) -> Instance
function create(instance: Instace): (Properties) -> Instance
type Properties = Map<string | number, any> type Properties = Map<string | number, any>
function create(class: string): (Properties) -> Instance
function create(instance: Instance): (Properties) -> Instance
``` ```
- ### Details - ### Details

View file

@ -4,7 +4,8 @@
- [source()](../api/reactivity-core.md#source) - [source()](../api/reactivity-core.md#source)
- [derive()](../api/reactivity-core.md#derive) - [derive()](../api/reactivity-core.md#derive)
- [map()](../api/reactivity-core.md#map) - [indexes()](../api/reactivity-core.md#indexes)
- [values()](../api/reactivity-core.md#values)
- [watch()](../api/reactivity-core.md#watch) - [watch()](../api/reactivity-core.md#watch)
### [Reactivity: Utility](../api/reactivity-utility.md) ### [Reactivity: Utility](../api/reactivity-utility.md)

View file

@ -39,9 +39,9 @@ Runs a callback on state change.
- ### Type - ### Type
```lua ```lua
function watch(callback: () -> ()): Unwatch
type Unwatch = () -> () type Unwatch = () -> ()
function watch(callback: () -> ()): Unwatch
``` ```
- ### Details - ### Details
@ -58,15 +58,15 @@ Runs a callback on state change.
- ### Example - ### Example
```lua ```lua
local state = wrap(1) local state = source(1)
watch(function() watch(function()
print(state.Value) print(state())
end) end)
-- prints 1 -- prints 1
state.Value += 1 state(state() + 1)
-- prints 2 -- prints 2
``` ```
@ -99,7 +99,7 @@ Derives a new state from existing states.
- ### Example - ### Example
```lua ```lua
local count = wrap(0) local count = source(0)
local text = derive(function() return `count: {count()}` end) local text = derive(function() return `count: {count()}` end)
text() -- "count: 0" text() -- "count: 0"

19
docs/api/type-docs.md Normal file
View file

@ -0,0 +1,19 @@
# Type Documentation
<br/>
## Map<K, V>
### Type Definition
```lua
type Map<K, V> = { [K]: V }
```
## Array<T>
### Type Definition
```lua
type Array<T> = { T }
```

View file

@ -19,7 +19,7 @@ local function Button(props: {
Position = props.Position, Position = props.Position,
Text = props.Text, Text = props.Text,
Callback = props.Callback Activated = props.Callback
} }
end end