From 01d73edae67d4b6db6d60480d83fccf9f042d1a9 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:40:42 +0100 Subject: [PATCH] Added onChange which calls observe (to keep the standard) --- src/elements/BaseElement.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/elements/BaseElement.lua b/src/elements/BaseElement.lua index d29ec60..40734b5 100644 --- a/src/elements/BaseElement.lua +++ b/src/elements/BaseElement.lua @@ -216,6 +216,16 @@ function BaseElement:handleEvent(event, ...) return false end +--- Observes a property and calls a callback when it changes +--- @shortDescription Observes a property and calls a callback when it changes +--- @param property string The property to observe +--- @param callback function The callback to call when the property changes +--- @return table self The BaseElement instance +function BaseElement:onChange(property, callback) + self:observe(property, callback) + return self +end + --- Returns the base frame of the element --- @shortDescription Returns the base frame of the element --- @return table BaseFrame The base frame of the element