File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 2
2
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
3
3
-- If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
4
5
+ --- @class Janitor
6
+
5
7
local RunService = game :GetService (" RunService" )
6
8
7
9
local Janitor = {}
@@ -31,6 +33,7 @@ function Janitor.isJanitor(value: table?)
31
33
return type (value ) == " table" and value .ClassName == " Janitor"
32
34
end
33
35
36
+ --- This function is used to create a new Janitor instance and assign to it an object.
34
37
function Janitor :Give (task : any )
35
38
local function handleTask (subtask : any )
36
39
assert (typeof (task ) ~= " boolean" , " Task cannot be a boolean" )
@@ -55,6 +58,7 @@ function Janitor:Give(task: any)
55
58
return handleTask (task )
56
59
end
57
60
61
+ --- This function is used to cleanup an object assigned to a currently running Janitor instance.
58
62
function Janitor :Cleanup (taskTable : table ? )
59
63
local tasks = taskTable or self ._tasks
60
64
@@ -87,6 +91,7 @@ function Janitor:Cleanup(taskTable: table?)
87
91
end
88
92
end
89
93
94
+ --- This function is used to destroy (basically delete) any Janitor instances currently running.
90
95
function Janitor :Destroy ()
91
96
self :Cleanup ()
92
97
You can’t perform that action at this time.
0 commit comments