A powerful and efficient task management and cleanup utility for Roblox, with built-in Knit integration.
- 🧹 Efficient resource cleanup and management
- 🔄 Automatic connection handling
- ⚡ Promise integration
- ⏱️ Interval task management
- 🏷️ Task labeling for debugging
- 🛠️ Seamless Knit framework integration
- Add the Sweep framework to your Roblox project
- Ensure you have the required dependencies:
- Knit framework
- (Optional) ProfileStore
local Sweep = require(ReplicatedStorage.Packages.Sweep)
-- Create a new Sweep instance
local sweep = Sweep.new()
-- Add tasks for cleanup
sweep:GiveTask(function()
print("Cleaning up!")
end)
-- Manage connections
sweep:GiveTask(workspace.ChildAdded:Connect(print))
-- Create interval tasks
sweep:GiveTask(sweep:GiveInterval(5, function()
print("Running every 5 seconds")
end))
-- Clean up all tasks
sweep:Clean()
-- Example Service Integration
local ExampleService = Knit.CreateService({
Name = "ExampleService",
Client = {},
})
function ExampleService:KnitInit()
self._sweep = Sweep.new()
-- Add cleanup tasks
self._sweep:GiveTask(workspace.ChildAdded:Connect(function(child)
print("New child added:", child.Name)
end))
end
function ExampleService:Destroy()
self._sweep:Clean()
end
For more information, please see:
MIT License - See LICENSE file for details
For more information, please see the LICENSE
Contributions are welcome! Please feel free to submit a Pull Request.
For more information, please see CONTRIBUTING.md