mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
18 lines
467 B
Text
18 lines
467 B
Text
local action = require "./action"()
|
|
local cleanup = require "./cleanup"
|
|
|
|
local function changed<T>(property: string, callback: (T) -> ())
|
|
return action(function(instance)
|
|
local con = instance:GetPropertyChangedSignal(property):Connect(function()
|
|
callback((instance :: any)[property])
|
|
end)
|
|
|
|
cleanup(function()
|
|
con:Disconnect()
|
|
end)
|
|
|
|
callback((instance :: any)[property])
|
|
end)
|
|
end
|
|
|
|
return changed
|