Skip to main content

ValueObject

To work like value objects in Roblox and track a single item, with .Changed events

Properties

Changed

ValueObject.Changed: Signal<T>--fireswitholdValue,newValue

Event fires when the value's object value change

Value

ValueObject.Value: T

The value of the ValueObject

Changed

ValueObject.Changed: Signal<()>--Fireswheneverthespringinitiallychangesstate

Event fires when the spring value changes

Functions

new

ValueObject.new(baseValueT) → ValueObject

Constructs a new value object

fromObservable

ValueObject.fromObservable(observableObservable<T>) → ValueObject<T>

Constructs a new value object

isValueObject

ValueObject.isValueObject(valueany) → boolean

Returns whether the object is a ValueObject class

Observe

ValueObject:Observe() → Observable<T>

Observes the current value of the ValueObject

Destroy

ValueObject:Destroy() → ()

Forces the value to be nil on cleanup, cleans up the Maid

Does not fire the event since 3.5.0

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new value object",
            "params": [
                {
                    "name": "baseValue",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ValueObject"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        },
        {
            "name": "fromObservable",
            "desc": "Constructs a new value object",
            "params": [
                {
                    "name": "observable",
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ValueObject<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 44,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        },
        {
            "name": "isValueObject",
            "desc": "Returns whether the object is a ValueObject class",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 59,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        },
        {
            "name": "Observe",
            "desc": "Observes the current value of the ValueObject",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 67,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Forces the value to be nil on cleanup, cleans up the Maid\n\nDoes not fire the event since 3.5.0",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 128,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Changed",
            "desc": "Event fires when the value's object value change",
            "lua_type": "Signal<T> -- fires with oldValue, newValue",
            "source": {
                "line": 33,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        },
        {
            "name": "Value",
            "desc": "The value of the ValueObject",
            "lua_type": "T",
            "source": {
                "line": 94,
                "path": "src/valueobject/src/Shared/ValueObject.lua"
            }
        },
        {
            "name": "Changed",
            "desc": "Event fires when the spring value changes",
            "lua_type": "Signal<()> -- Fires whenever the spring initially changes state",
            "source": {
                "line": 40,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        }
    ],
    "types": [],
    "name": "ValueObject",
    "desc": "To work like value objects in Roblox and track a single item,\nwith `.Changed` events",
    "source": {
        "line": 6,
        "path": "src/valueobject/src/Shared/ValueObject.lua"
    }
}