Global
Updated on Sep 3, 2025 9 minutes to readProperties
Property | Description |
---|---|
object | List-type metadata available in Object Form to read and modify attributes. |
vars | Shared variables across server, client, and components within a form. |
Methods
Method | Description |
---|---|
$delete | Deletes a property from a target object. |
$get | Retrieves a property from a target object. |
$nextTick | Executes a callback on the next DOM update cycle. |
$on | Registers an event listener. Supports generic and specific events. |
$set | Sets a property on a target object. |
$t | Translates a key into a string, optionally with parameters. |
$watch | Watches a property or expression for changes with optional callbacks or options. |
getLang | Returns the current language as a string. |
getLocale | Returns the current locale as a string. |
getRefPresentation | Retrieves the text of a reference presentation by scriptAlias and objectId. |
getReadonly | Returns whether the form is read-only. |
getSize | Returns the current form size. |
goHome | Navigates to the home page of the app. |
isMobileApp | Returns whether the app is running in a mobile environment. |
isModified | Returns whether the current object is modified. |
saveCurrentObject | Saves the current object, optionally notifying the user. |
saveCurrentObjectAndClose | Saves the current object and closes the form. |
setModified | Marks the current object as modified or unmodified. |
setReadonly | Sets the read-only state of the form. |
setRefPresentation | Sets the text of a reference presentation by scriptAlias and objectId. |
setSize | Sets the current form size. |
Methods Details
$delete()
• Type
(target: any, key: string | number) => void
• Details
Expects a target object and a key representing the property to delete.
$get()
• Type
(target: any, key: string | number) => any
• Details
Expects a target object and a key representing the property to retrieve.
Returns the value stored under the given key, or undefined
if not found.
$nextTick()
• Type
(callback: Function) => void
• Details
Schedules the provided callback to be executed after the next DOM update cycle or after the current call stack is cleared, ensuring that any changes to reactive data or state are fully applied before the callback runs.
This is useful when you need to perform operations that rely on the latest state of the application or when interacting with elements that may have been updated asynchronously.
The callback receives no arguments and is executed once. Multiple calls to $nextTick queue their callbacks in order.
$on()
• Type
// Generic event
(name: string, callback: Function) => void;
// Specific event: triggered when a Modal Form is closed
(
name: 'close-form',
callback: (scriptAlias: E8ScriptAlias, objectId?: E8ObjectId) => void
) => void;
• Details
Expects an event name (string) and a callback function.
For the 'close-form' event, the callback receives two arguments: a script alias and optionally a record ID.
⚠️ The 'close-form' event is triggered when a Modal Form (application form opened in a modal window) is closed. Do not confuse this with a regular modal UI component.
• Example
// Subscribe to a generic event
E8App.$on('custom-event', () => {
console.log('Custom event triggered');
});
// Subscribe specifically to the Modal Form close event
E8App.$on('close-form', (scriptAlias, objectId) => {
console.log(`Modal Form closed. Alias: ${scriptAlias}, ObjectId: ${objectId ?? 'not provided'}`);
});
$set()
• Type
(target: any, key: string | number, value: any) => any
• Details
Expects a target object, a key, and a value to assign.
Returns the assigned value.
• Example
// Initialize an array in E8App.vars
const assignedArray = E8App.$set(E8App.vars, 'myArray', [1, 2, 3]);
console.log(assignedArray);
// Output: [1, 2, 3]
console.log(E8App.vars.myArray);
// Output: [1, 2, 3]
// Update the second element (index 1) of the array
const updatedValue = E8App.$set(E8App.vars.myArray, 1, 42);
console.log(updatedValue);
// Output: 42
console.log(E8App.vars.myArray);
// Output: [1, 42, 3]
$t()
• Type
(key: string, params?: object) => string
• Details
Expects a key and optionally params for interpolation.
Returns the localized string.
$watch()
• Type
(key: string, params?: object) => string
• Details
Watches a property or expression for changes and triggers a callback whenever the value changes.
The expression is a string representing the property to observe (e.g., "vars.myValue").
The options can be a callback function or an WatchOptions object.
This allows you to react to changes in reactive data and perform side effects when the watched value updates.
• Example
// Initialize a nested object in E8App.vars
E8App.$set(E8App.vars, 'user', {
name: 'Alice',
preferences: {
theme: 'light'
}
});
// Watch a simple property with immediate: true
E8App.$watch('vars.user.name', {
handler(newValue, oldValue) {
console.log(`Name changed from ${oldValue} to ${newValue}`);
},
immediate: true
});
// Console output immediately: Name changed from undefined to Alice
// Update the property
E8App.$set(E8App.vars.user, 'name', 'Bob');
// Console output: Name changed from Alice to Bob
// Watch a nested property deeply
E8App.$watch('vars.user.preferences', {
handler(newValue, oldValue) {
console.log('Preferences changed:', oldValue, '→', newValue);
},
deep: true
});
// Update a nested property
E8App.$set(E8App.vars.user.preferences, 'theme', 'dark');
// Console output: Preferences changed: { theme: 'light' } → { theme: 'dark' }
getLang()
• Type
() => string
• Details
Returns the current language code as a string.
getLocale()
• Type
() => string
• Details
Returns the current locale string.
getRefPresentation()
• Type
(scriptAlias: E8ScriptAlias, id: E8ObjectId) => string | null
• Details
Expects a script alias and a record ID.
Returns the reference presentation string, or null
if not available.
getReadonly()
• Type
() => boolean
• Details
Expects no parameters.
Returns true
if the form is read-only, otherwise false
.
getSize()
• Type
() => FormSizes
• Details
Returns the current form size.
goHome()
• Type
() => void
• Details
Navigates to the application's home page.
isMobileApp()
• Type
() => boolean
• Details
Returns true
if the app is running in a mobile environment, otherwise false
.
isModified()
• Type
() => boolean
• Details
Returns true
if the current object has been modified, otherwise false
.
saveCurrentObject()
• Type
(notify?: boolean) => Promise<void>
• Details
Expects an optional notify to determine if a success notification should be shown.
Returns a Promise that resolves after saving.
saveCurrentObjectAndClose()
• Type
() => Promise<void>
• Details
Returns a Promise that resolves after saving and closing the form.
setModified()
• Type
(state: boolean) => void
• Details
Expects a state.
Updates the modified (dirty) flag.
setReadonly()
• Type
(state: boolean) => void
• Details
Expects a state.
Sets the read-only state.
setRefPresentation()
• Type
(scriptAlias: E8ScriptAlias, id: E8ObjectId, text: string) => void
• Details
Expects a script alias, a record ID, and a text.
Assigns the presentation string.
setSize()
• Type
(size: FormSizes) => void
• Details
Expects a form size value.
Sets the form size.