Show raw api
{
"functions": [
{
"name": "new",
"desc": "Creates a new bucket instance.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\nBucketInstance:Add(...)\nBucketInstance:Remove(...)\nBucketInstance:Destroy()\n```",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Bucket"
}
],
"function_type": "static",
"source": {
"line": 94,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "Add",
"desc": "Adds userdata or an instance to the bucket. Supported types include: Instance, RBXScriptConnection, function, thread, or table.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\nBucketInstance:Add(workspace.Baseplate)\n\nBucketInstance:Add(RunService.RenderStepped:Connect(function()\n\t-- ...\nend))\n\nBucketInstance:Add(function()\n\t-- ...\nend)\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
},
{
"name": "Object",
"desc": "The object to be cleaned up",
"lua_type": "any"
},
{
"name": "CleanupMethodName",
"desc": "If you're passing a table, this is an optional setting to choose the cleanup function name (defaults to Destroy or Disconnect)",
"lua_type": "string?"
}
],
"returns": [
{
"desc": "The object you inputted",
"lua_type": "any"
}
],
"function_type": "static",
"source": {
"line": 125,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "AddPromise",
"desc": "Adds a promise to the bucket. Will return the promise, meaning it can be chained.\n\n```lua\n-- local MyPromise = ...\n\nlocal BucketInstance = Bucket.new()\n\nBucketInstance:AddPromise(MyPromise)\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
},
{
"name": "Object",
"desc": "The promise to be cleaned up",
"lua_type": "Promise"
}
],
"returns": [
{
"desc": "The same promise that was inputted",
"lua_type": "Promise"
}
],
"function_type": "static",
"source": {
"line": 148,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "AttachToInstance",
"desc": "Tells the Bucket to destroy itself when the inputted instance is destroyed or parented to nil.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\nBucketInstance:AttachToInstance(PartInstance)\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
},
{
"name": "Object",
"desc": "The instance to track",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "static",
"source": {
"line": 182,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "Extend",
"desc": "Creates another Bucket and adds it to this (the parent) one.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\nlocal SubBucketInstance = BucketInstance:Extend()\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
}
],
"returns": [
{
"desc": "The sub-Bucket",
"lua_type": "Bucket"
}
],
"function_type": "static",
"source": {
"line": 210,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "Remove",
"desc": "Removes an object from Bucket's cleanup.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\nBucketInstance:Add(Value)\nBucketInstance:Remove(Value) -- No longer cleaned up\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
},
{
"name": "Object",
"desc": "The object to be removed from cleanup",
"lua_type": "any"
}
],
"returns": [],
"function_type": "static",
"source": {
"line": 235,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "GetWrappedDestroy",
"desc": "Returns a function that, when called, destroys the Bucket.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\nlocal Destroy = BucketInstance:GetWrappedDestroy()\n\nDestroy()\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
}
],
"returns": [
{
"desc": "",
"lua_type": "() -> nil"
}
],
"function_type": "static",
"source": {
"line": 257,
"path": "src/Packages/Bucket/init.luau"
}
},
{
"name": "Destroy",
"desc": "Destroys the Bucket, cleaning up all objects and promises inside of it.\n\n```lua\nlocal BucketInstance = Bucket.new()\n\n-- Add stuff...\n\nBucketInstance:Destroy()\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "Bucket"
}
],
"returns": [],
"function_type": "static",
"source": {
"line": 275,
"path": "src/Packages/Bucket/init.luau"
}
}
],
"properties": [],
"types": [],
"name": "Bucket",
"desc": "Used for cleanup of various data types and instances.",
"source": {
"line": 6,
"path": "src/Packages/Bucket/init.luau"
}
}