1.17.0-ts.1 • Published 11 months ago
@rbxts/janitor v1.17.0-ts.1
@rbxts/janitor
Typings for howmanysmall's forked janitor module
View the Janitor docs!
Credits to Validark for the original module, see RoStrap's Janitor docs for more information.
Installation:
npm i @rbxts/janitor
Changes
- Gets the Promise lib by using
_G
rather than using wally package-esque import Returns
return table.freeze({ Janitor = Janitor })
instead of just returning the
Janitor
namespace.
Example Usage
import { Janitor } from "@rbxts/janitor";
const Obliterator = new Janitor<{ Instances: Instance }>();
print(Obliterator.Add(new Instance("Part")));
// Queue the Part to be Destroyed at Cleanup time
Obliterator.Add(new Instance("Part"), "Destroy");
// Queue function to be called with `true` MethodName
Obliterator.Add(print, true);
// By passing an Index, the Object will occupy a namespace
// If "Instances" already exists, it will call :Remove("Instances") before writing
Obliterator.Add(new Instance("Part"), "Destroy", "Instances");
// Queue a promise to be cancelled when the Janitor is cleaned
// `result` is of type Promise<number>
const result = Obliterator.AddPromise(
new Promise<number>((resolve, _reject) => {
task.wait(5);
resolve(42);
})
);
// Cleanup all connections, calling `print`, Destroying our Part, and cancelling our promise
Obliterator.Cleanup();
Changelog
See CHANGELOG.md
1.17.0-ts.1
11 months ago
1.17.0-ts.0
11 months ago
1.16.0-ts.0
1 year ago
1.15.7-ts.0
1 year ago
1.15.4-ts.0
2 years ago
1.15.3-ts.0
2 years ago
1.14.1-ts.1
3 years ago
1.14.1-ts.0
3 years ago
1.14.0-ts.1
3 years ago
1.14.0-ts.0
3 years ago
1.13.15-ts.0
4 years ago
1.13.12-ts.0
4 years ago
1.13.12-ts.1
4 years ago
1.13.6-ts.0
4 years ago
1.13.5-ts.2
4 years ago
1.13.5-ts.0
4 years ago
1.13.5-ts.1
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago