{"id":"stratiz/Cleaner","name":"Cleaner","scope":"stratiz","platform":"roblox","description":"Super simple Maid/Janitor module for tracking and tearing down objects.","version":"1.1.0","latest":"1.1.0","versions":["1.0.0","1.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"703940d5dbeecb51606d632a77849a10bfddf072f060cd69b8c4ba551272b93a","likes":2,"downloads":5,"install":"forest install stratiz/Cleaner","url":"https://forest.dev/p/roblox/stratiz/Cleaner","files":"https://api.forest.dev/ai/package/roblox/stratiz/Cleaner/files","readme":"# Cleaner\n\nA small Maid style helper for tracking objects and tearing them down together.\n\n## Usage\n\n```lua\nlocal Cleaner = require(path.to.Cleaner)\n\nlocal cleaner = Cleaner.new()\n\ncleaner:Add(workspace.Part)\ncleaner:Add(part.Touched:Connect(onTouch), task.spawn(runLoop))\ncleaner:Add(function()\n    print(\"cleaned up\")\nend)\n\ncleaner:Destroy()\n```\n\n## API\n\n### Cleaner.new()\n\nReturns a new cleaner.\n\n### Cleaner:Add(...)\n\nTracks one or more objects. Accepts an Instance, an RBXScriptConnection, a thread, a function, or any table with a Destroy method. Adding the same object twice is ignored. Returns the object when given one, or a table of the objects when given several.\n\n### Cleaner:Remove(...)\n\nStops tracking one or more objects. They are not cleaned.\n\n### Cleaner:Digest(object, includeFunctions)\n\nScans a table, such as an OOP object, and tracks every cleanable value inside it. Functions are skipped unless `includeFunctions` is true, so methods on plain table objects are not called during cleanup. Returns a table of the values that could not be tracked.\n\n### Cleaner:Destroy()\n\nCleans every tracked object, then clears the list. Instances and tables are destroyed, connections are disconnected, threads are cancelled, and functions are called. Also available as `Cleaner:Clean()`.\n","readmeTruncated":false}