Skip to main content

Lifecycle

A lifecycle event

Properties

Name

This item is read only and cannot be modified. Read Only
Lifecycle.Name: string

Name of the lifecycle

Functions

new

Lifecycle.new(
namestring,--

Name of the lifecycle event

) → Lifecycle

Create a new lifecycle event

Dispatch

Lifecycle:Dispatch(
...any--

Args to pass to all singletons which implement this lifecycle event

) → ()

Dispatch the lifecycle event with some arguments which are passed all singletons which implement this lifecycle event.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Create a new lifecycle event",
            "params": [
                {
                    "name": "name",
                    "desc": "Name of the lifecycle event",
                    "lua_type": "string"
                },
                {
                    "name": "handler",
                    "desc": "",
                    "lua_type": "LifecycleHandler"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Lifecycle"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 33,
                "path": "Source/Core/Lifecycle.luau"
            }
        },
        {
            "name": "Dispatch",
            "desc": "Dispatch the lifecycle event with some arguments which are passed all singletons which implement\nthis lifecycle event.",
            "params": [
                {
                    "name": "...",
                    "desc": "Args to pass to all singletons which implement this lifecycle event",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 70,
                "path": "Source/Core/Lifecycle.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "Name",
            "desc": "Name of the lifecycle\n\t",
            "lua_type": "string",
            "readonly": true,
            "source": {
                "line": 47,
                "path": "Source/Core/Lifecycle.luau"
            }
        },
        {
            "name": "_OnDispatch",
            "desc": "Handler which is in charge of calling the functions on singletons\n\t",
            "lua_type": "LifecycleHandler",
            "private": true,
            "readonly": true,
            "source": {
                "line": 57,
                "path": "Source/Core/Lifecycle.luau"
            }
        }
    ],
    "types": [],
    "name": "Lifecycle",
    "desc": "A lifecycle event",
    "source": {
        "line": 24,
        "path": "Source/Core/Lifecycle.luau"
    }
}