search/
Start typing to search packages!
package_2
janitor
By @nazumahk
Roblox
MirroredJanitor
A strictly typed, high-performance resource management library for Luau.
Features
- Strict Generics: Full type safety with
<T>and variadic<A...>generics across all registration methods. - Vow Integration: Native support for cancelling asynchronous tasks registered via
AddVow. - Index-Based Retrieval: Named resources can be retrieved, replaced, or individually removed at any time.
- Thread-Safe Cleanup: Coroutine cancellation handled via
FastDeferto avoid self-cancellation panics. - Zero-Overhead Linking: Instance destruction events automatically trigger cleanup via
LinkToInstance.
Installation
Add to your wally.toml:
[dependencies]
Janitor = "nazumahk/janitor@1.0.1"
Quick Start
local Janitor = require(path.to.Janitor)
local janitor = Janitor.new()
-- Register an instance
local part = janitor:Add(Instance.new("Part"))
-- Register a connection
janitor:Add(RunService.Heartbeat:Connect(function() end))
-- Register a cleanup function
janitor:Add(function()
print("cleaned up")
end, true)
-- Register a Vow (cancelled automatically if not settled)
janitor:AddVow(Vow.delay(10))
-- Link to instance destruction
janitor:LinkToInstance(workspace.SomePart)
-- Dispose all resources
janitor:Cleanup()
Documentation
- Why Use Janitor? -- Benefits and Case Studies
- Technical Architecture -- Internal Design & Optimizations
- API Reference -- Full Method Specification
License
MIT
Package Details
Install command (Click to copy)
Version
1.0.2
License
MIT
Safe for commercial use
Automated license review — not legal advice.
