{"id":"howmanysmall/janitor","name":"janitor","scope":"howmanysmall","platform":"roblox","description":"A garbage collector object implementation for Roblox, featuring support for custom cleanup methods, Promises, and instance linking.","version":"1.18.3","latest":"1.18.3","versions":["1.13.10","1.13.11","1.13.12","1.13.13","1.13.14","1.13.15","1.13.16","1.14.0","1.14.1","1.14.2","1.15.0","1.15.1","1.15.2","1.15.3","1.15.4","1.15.5","1.15.6","1.15.7","1.16.0","1.17.0","1.18.0","1.18.1","1.18.2","1.18.3"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"howmanysmall/typed-promise":{"version":"^4.0.3","alias":"Promise"}},"integrity":"b40b7414775a58ccbf3f8ecdbced9c26afd64e5582d2564175fa3062f9669d88","likes":0,"downloads":4,"install":"forest install howmanysmall/janitor","url":"https://forest.dev/p/roblox/howmanysmall/janitor","files":"https://api.forest.dev/ai/package/roblox/howmanysmall/janitor/files","readme":"# Janitor\n\nJanitor library. This branch is for the thread safe version of Janitor that does not use a global state.\n\n[Original](https://github.com/RoStrap/Events/blob/master/Janitor.lua) was made by [Validark](https://github.com/Validark), however he doesn't really maintain that version anymore. It does have all the [original documentation](https://rostrap.github.io/Libraries/Events/Janitor/) for it though.\n\n[Now on roblox-ts!](https://www.npmjs.com/package/@rbxts/janitor)\n\n## Projects that use Janitor\n\nIf your project uses Janitor, leave a PR on the readme!\n\n- [Armtastic](https://www.roblox.com/games/6242582774/SHOP-Armtastic-Alpha) by [Mullets Mafia Red](https://www.roblox.com/groups/9160772/Mullet-Mafia-Red#!/about)\n- [Be an Alien: Renewal](https://www.roblox.com/games/463915360/Be-an-Alien-Renewal) by [PeZsmistic](https://www.roblox.com/users/121643/profile)\n- [Benchmarker](https://www.roblox.com/library/5853950046/Benchmarker) by [boatbomber](https://www.roblox.com/users/33655127/profile/)\n- [RBLX04](https://www.roblox.com/games/5040794421/RBLX04-A-ROBLOX-2004-Simulation) by [movsb](https://www.roblox.com/games/5040794421/RBLX04-A-ROBLOX-2004-Simulation)\n- [RepoToRoblox](https://www.roblox.com/library/6284281701/RepoToRoblox) by [a great friend](https://www.roblox.com/users/33655127/profile) (boatbomber lol)\n- [Science Simulator](https://www.roblox.com/games/5414779423/5M-EVENT-Science-Simulator) by [Interbyte Studio](https://www.roblox.com/groups/5126818/Interbyte-Studio#!/about)\n- [Studio Tweaks](https://www.roblox.com/library/5601031949/Studio-Tweaks) by [PeZsmistic](https://www.roblox.com/users/121643/profile)\n- [Bloopville (NOT RELEASED)](https://www.roblox.com/games/1919575283/BloopVille0) by [BloopVille Team](https://www.bloopville.com/)\n- [Tropical Town Tycoon](https://www.roblox.com/games/8391439627/) by [Mightybull Games](https://www.roblox.com/groups/8573100/Mightybull-Games)\n\n## Why use Janitor?\n\n- Janitor makes dealing with garbage collection much less annoying and stressful because it manages them all in a nice interface.\n- `Janitor:Add` returns whatever was added, which Maid doesn't.\n- `Janitor:Add` also accepts a custom method, if you want to call `:Stop` on a `Tween`. You can see this being used in the [JanitorPromise](https://github.com/howmanysmall/Janitor/blob/main/src/Promise/init.lua#L100) library.\n- `Janitor:Add` also accepts a custom reference to store under, which keeps the api more consistent. (`Maid.A = X` and `Maid:GiveTask(Y)` vs `Janitor:Add(X, nil, \"A\")` and `Janitor:Add(Y)`)\n- Janitor also allows linking to an Instance, so when the Instance is destroyed, the Janitor cleans up everything along with it.\n\n### Some less important benefits\n\n- Runs a little better than Maid does.\n\n## Performance\n\nJanitor runs incredibly well. It is quite a bit faster than [Maid](https://github.com/Quenty/NevermoreEngine/blob/version2/Modules/Shared/Events/Maid.lua) and around as fast as [Dumpster](https://gist.github.com/Fraktality/f0ab4ad950698e9f08bb01bea486845e). You can run the benchmark for yourself using [boatbomber's benchmark plugin](https://devforum.roblox.com/t/benchmarker-plugin-compare-function-speeds-with-graphs-percentiles-and-more/829912) and the bench found [here](https://github.com/boatbomber/BenchmarkerLibrary).\n\n![Benchmark results](https://cdn.discordapp.com/attachments/507950082285502465/807365433388433408/unknown.png)\n\nBenchmarks ran on an R9 3900X with 32GB of DDR4-3600 RAM.\n","readmeTruncated":false}