-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Elttob/Fusion
- Loading branch information
Showing
8 changed files
with
152 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<nav class="fusiondoc-api-breadcrumbs"> | ||
<a href="../..">Fusion</a> | ||
<a href="..">Instances</a> | ||
</nav> | ||
|
||
<h1 class="fusiondoc-api-header" markdown> | ||
<span class="fusiondoc-api-icon" markdown>:octicons-key-24:</span> | ||
<span class="fusiondoc-api-name">Cleanup</span> | ||
<span class="fusiondoc-api-pills"> | ||
<span class="fusiondoc-api-pill-type">special key</span> | ||
<span class="fusiondoc-api-pill-since">since v0.2</span> | ||
</span> | ||
</h1> | ||
|
||
Cleans up all items given to it when the instance is destroyed, equivalent to | ||
passing the items to `Fusion.cleanup`. | ||
|
||
----- | ||
|
||
## Example Usage | ||
|
||
```Lua | ||
local example1 = New "Folder" { | ||
[Cleanup] = function() | ||
print("I'm in danger!") | ||
end | ||
} | ||
|
||
local example2 = New "Folder" { | ||
[Cleanup] = example1 | ||
} | ||
|
||
local example3 = New "Folder" { | ||
[Cleanup] = { | ||
RunService.RenderStepped:Connect(print), | ||
function() | ||
print("I'm in danger also!") | ||
end, | ||
example2 | ||
} | ||
} | ||
|
||
example3:Destroy() | ||
``` | ||
|
||
----- | ||
|
||
## Technical Details | ||
|
||
This special key runs at the `observer` stage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<nav class="fusiondoc-api-breadcrumbs"> | ||
<a href="../..">Fusion</a> | ||
<a href="..">State</a> | ||
</nav> | ||
|
||
<h1 class="fusiondoc-api-header" markdown> | ||
<span class="fusiondoc-api-icon" markdown>:octicons-code-24:</span> | ||
<span class="fusiondoc-api-name">cleanup</span> | ||
<span class="fusiondoc-api-pills"> | ||
<span class="fusiondoc-api-pill-type">function</span> | ||
<span class="fusiondoc-api-pill-since">since v0.2</span> | ||
</span> | ||
</h1> | ||
|
||
Attempts to destroy all destructible objects passed to it. | ||
|
||
```Lua | ||
(...any) -> () | ||
``` | ||
|
||
----- | ||
|
||
## Parameters | ||
|
||
- `...` - Any objects that need to be destroyed. | ||
|
||
----- | ||
|
||
## Example Usage | ||
|
||
```Lua | ||
Fusion.cleanup( | ||
workspace.Part1, | ||
RunService.RenderStepped:Connect(print), | ||
function() | ||
print("I will be run!") | ||
end | ||
) | ||
``` | ||
|
||
----- | ||
|
||
## Destruction Behaviour | ||
|
||
Destruction behaviour varies by type: | ||
|
||
- if `Instance`, `:Destroy()` is called | ||
- ...else if `RBXScriptConnection`, `:Disconnect()` is called | ||
- ...else if `function`, it is called | ||
- ...else if `{destroy: (self) -> ()}`, `:destroy()` is called | ||
- ...else if `{Destroy: (self) -> ()}`, `:Destroy()` is called | ||
- ...else if `{any}`, `Fusion.cleanup` is called on all members | ||
- ...else nothing occurs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<nav class="fusiondoc-api-breadcrumbs"> | ||
<a href="../..">Fusion</a> | ||
<a href="..">State</a> | ||
</nav> | ||
|
||
<h1 class="fusiondoc-api-header" markdown> | ||
<span class="fusiondoc-api-icon" markdown>:octicons-code-24:</span> | ||
<span class="fusiondoc-api-name">doNothing</span> | ||
<span class="fusiondoc-api-pills"> | ||
<span class="fusiondoc-api-pill-type">function</span> | ||
<span class="fusiondoc-api-pill-since">since v0.2</span> | ||
</span> | ||
</h1> | ||
|
||
No-op function - does nothing at all, and returns nothing at all. Intended for | ||
use as a destructor when no destruction is needed. | ||
|
||
```Lua | ||
(...any) -> () | ||
``` | ||
|
||
----- | ||
|
||
## Parameters | ||
|
||
- `...` - Any objects. | ||
|
||
----- | ||
|
||
## Example Usage | ||
|
||
```Lua | ||
local foo = Computed(function() | ||
return workspace.Part | ||
end, Fusion.doNothing) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters