Skip to content

Actions

Actions are special events that you can use to make your UI tree more reactive.

Usage

To use an action, call Teisu.action and pass in a callback:

luau
local action = Teisu.action
local new = Teisu.new

local text_label = new "TextLabel" {
    Text = "Hello, world!"

    action(function(instance)
        print(instance.Text)
    end)
}
luau
Hello, world!

Detecting Property Changes

Teisu provides the changed action, which allows you to listen for property changes on the parent instance.

luau
local changed = Teisu.changed
local new = Teisu.new
local flec = Teisu.flec

local text = flec("Hello, world!")

local text_label = new "TextLabel" {
    Text = flec,

    changed("Text", function(text: string)
        print(text)
    end)
}

task.wait(2)
text("Goodbye!")
luau
Hello, world!
(..2 seconds later)
Goodbye!

Released under the MIT License.