Skip to main content

promiseCleanupUtil

An utility module for working with Promise cleanups.

Functions

addPromiseAndCleanupOnFinishedRunning

promiseCleanupUtil.addPromiseAndCleanupOnFinishedRunning(
promisePromise,
keystring,
cleanupTable{[string]Promise}
) → ()

Adds the given promise to cleanupTable, indexed by key. Once the promise has finished running, it'll be safely removed from cleanupTable.

findAndCancelPromise

promiseCleanupUtil.findAndCancelPromise(
keystring,
cleanupTable{[string]any}
) → ()

Finds the given promise keyed by key in cleanupTable, if found, it will be cancelled and the promise will be removed from the cleanupTable..

Show raw api
{
    "functions": [
        {
            "name": "addPromiseAndCleanupOnFinishedRunning",
            "desc": "Adds the given `promise` to `cleanupTable`, indexed by `key`. Once the promise has finished running, it'll be safely\nremoved from `cleanupTable`.",
            "params": [
                {
                    "name": "promise",
                    "desc": "",
                    "lua_type": "Promise"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "cleanupTable",
                    "desc": "",
                    "lua_type": "{[string]: Promise}"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 16,
                "path": "src/promiseCleanupUtil/init.luau"
            }
        },
        {
            "name": "findAndCancelPromise",
            "desc": "Finds the given promise keyed by `key` in `cleanupTable`, if found, it will be cancelled and\nthe promise will be removed from the `cleanupTable`..",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "cleanupTable",
                    "desc": "",
                    "lua_type": "{ [string]: any }"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 34,
                "path": "src/promiseCleanupUtil/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "promiseCleanupUtil",
    "desc": "An utility module for working with [Promise](https://eryn.io/roblox-lua-promise/) cleanups.",
    "source": {
        "line": 6,
        "path": "src/promiseCleanupUtil/init.luau"
    }
}