mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Make root() return destructor automatically
This commit is contained in:
parent
8142acd1c1
commit
82eec61c45
8 changed files with 26 additions and 30 deletions
|
|
@ -14,18 +14,15 @@ Creates and runs a function in a new stable scope.
|
|||
- **Type**
|
||||
|
||||
```lua
|
||||
function root<T...>(fn: (destroy: () -> ()) -> T...): T...
|
||||
function root<T...>(fn: (() -> ()) -> T...): (() -> (), T...)
|
||||
```
|
||||
|
||||
- **Details**
|
||||
|
||||
Returns the result of the given function.
|
||||
Returns a function to destroy the root scope. Also passes this function as
|
||||
the first argument into its callback.
|
||||
|
||||
Creates a new stable scope, where creation of effects can be tracked and
|
||||
properly disposed of.
|
||||
|
||||
A function to destroy the root is passed into the callback, which will run
|
||||
any cleanups and allow derived sources created to garbage collect.
|
||||
All values returned by the callback are also returned following the destructor.
|
||||
|
||||
## source()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue