import{_ as t,a,b as r,ag as l}from"./chunks/framework.BcrMLAmg.js";const b=JSON.parse('{"title":"BaseElement","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/BaseElement.md","filePath":"references/elements/BaseElement.md","lastUpdated":1757844696000}'),n={name:"references/elements/BaseElement.md"};function s(d,e,o,i,c,h){return r(),a("div",null,e[0]||(e[0]=[l('
The base class for all UI elements in Basalt. This class provides basic properties and event handling functionality.
Extends: PropertySystem
| Property | Type | Default | Description |
|---|---|---|---|
| type | string | BaseElement | The type identifier of the element |
| id | string | BaseElement | The unique identifier for the element |
| name | string | BaseElement | The name of the element |
| eventCallbacks | table | BaseElement | The event callbacks for the element |
| enabled | boolean | BaseElement | Whether the element is enabled or not |
| Method | Returns | Description |
|---|---|---|
| BaseElement.defineEvent | - | Registers a new event listener for the element (on class level) |
| BaseElement.registerEventCallback | - | Registers a new event callback for the element (on class level) |
| BaseElement:isType | boolean | Checks if the element is a specific type |
| BaseElement:listenEvent | table | Enables or disables event listening for a specific event |
| BaseElement:registerCallback | table | Registers a callback function |
| BaseElement:fireEvent | table | Triggers an event and calls all registered callbacks |
| BaseElement:onChange | table | Observes a property and calls a callback when it changes |
| BaseElement:getBaseFrame | BaseFrame | Returns the base frame of the element |
| BaseElement:destroy | - | Destroys the element and cleans up all references |
| BaseElement:updateRender | table | Requests a render update for this element |
Registers a new event listener for the element (on class level)
class table The class to registereventName string The name of the event to registerrequiredEvent (optional) string The name of the required event (optional)Registers a new event callback for the element (on class level)
class table The class to registercallbackName string The name of the callback to registerstring The names of the events to register the callback forChecks if the element is a specific type
type string The type to check forboolean isType Whether the element is of the specified typeEnables or disables event listening for a specific event
eventName string The name of the event to listen forenable (optional) boolean Whether to enable or disable the event (default: true)table self The BaseElement instanceRegisters a callback function for an event
event string The event to register the callback forcallback function The callback function to registertable self The BaseElement instanceTriggers an event and calls all registered callbacks
event string The event to fireany Additional arguments to pass to the callbackstable self The BaseElement instanceObserves a property and calls a callback when it changes
property string The property to observecallback function The callback to call when the property changestable self The BaseElement instanceReturns the base frame of the element
BaseFrame BaseFrame The base frame of the elementDestroys the element and cleans up all references
Requests a render update for this element
table self The BaseElement instance