Skip to content

Bind ​

Functions ​

model ​

luau
Bind.model<T>(node: { read get: (any) -> T, read peek: (any) -> T, read set: (any, ...any) -> any }): T

Wraps a reactive node for two-way binding on an Instance property, attribute, or tag. Updates the instance from node and writes changes back to node when the instance fires its changed signal.

Open Documentation

isModel ​

luau
Bind.isModel(value: unknown): boolean

Returns true when value is a Flux.model wrapper.

Open Documentation

modelNode ​

luau
Bind.modelNode(value: unknown): Graph.Node<any>?

Returns the underlying node from a Flux.model wrapper, or nil if value is not a model.

luau
local node = Flux.modelNode(props.value)
if node then
	node:set(text)
end

Open Documentation

listen ​

luau
Bind.listen<T>(node: Graph.Node<T>, fn: (value: T) -> ()): () -> ()

Subscribes fn to updates of node with RBXScriptSignal:Connect semantics and returns an unsubscribe function. Fires on each flush after node changes, spawning fn(value) on its own thread via task.spawn so callbacks may yield freely.

Open Documentation

fromSignal ​

luau
Bind.fromSignal(sig: any, initial: any): Graph.Node<any>

Creates a node updated from the first argument of an RBXScriptSignal or signal table with :Connect() / :connect(), seeding from initial and deduplicating equal values. Disconnects automatically when the node or its owning scope is destroyed.

property ​

luau
Bind.property<I, K>(instance: I & Instance, property: K | "Name"): Graph.Node<Type.PropertyType<I, K>>

Creates a node mirroring an Instance property, an attribute ($Name or _attr_Name), or a CollectionService tag (#Tag or _tag_Tag). Disconnects automatically when instance, the node, or its owning scope is destroyed.

luau
local text = Flux.property(textBox, "Text")
local health = Flux.property(character, "$Health")
local isEnemy = Flux.property(character, "#Enemy")

Open Documentation

on ​

luau
Bind.on<D, R>(deps: D, fn: (input: Type.OnInput<D>, prevInput: Type.OnInput<D>?, prevResult: R?) -> R, defer: boolean?): (prevResult: R?) -> R?

portal ​

luau
Bind.portal(target: Graph.Reactive<Instance?>, children: any): Portal

Creates a portal mounting children into target (static Instance or reactive target node) without transferring ownership of target. Mounted children are unparented when the owning scope tears down, the target changes, or the portal host is destroyed.

Open Documentation