Creates an instance of the Application. This class is a singleton; an assertion will fail if multiple instances are created.
Configuration properties for the application.
Static ReadonlyprocessProvides access to process-related information, such as touch capabilities.
Adds a keyboard shortcut to the whole application: it works wherever
the focus is, even in a dialog. A key typed in a field is not a
shortcut, unless editable is set.
"Mod+S", "F1"... or several of them. Mod is Ctrl, or Cmd on a Mac.
Optionaloptions: ShortcutOptionscalled when element is removed from dom
Dispatches an event with a given name and payload to all registered listeners. If no listeners are registered for the event name, or if no EventSource has been initialized, this method does nothing.
Moves focus to the next or previous focusable element within the application. Handles Tab and Shift+Tab key presses.
If true, focus moves to the next element; if false, to the previous.
true if focus was successfully moved, false otherwise.
Retrieves an environment variable from the application's environment map.
The name of the environment variable.
Optionaldef_value: T
An optional default value to return if the variable is not found.
The value of the environment variable, or def_value if not found.
Retrieves the main view component of the application.
The application's main view component.
Retrieves a value from the browser's local storage.
The key of the value to retrieve.
The stored value as a string, or null if not found.
Retrieves and parses a JSON value from the browser's local storage.
The key of the JSON value to retrieve.
The parsed JSON object, or undefined if not found or parsing fails.
Removes a previously registered event listener. If the listener was not found or no events were registered, this method does nothing.
Registers an event listener for a specific event name.
The listener will be invoked when an event with the given name is fired.
Returns an object with an off() method, which can be used to conveniently remove this specific listener.
An object containing an off() method to unsubscribe the listener.
Sets an environment variable in the application's environment map.
The name of the environment variable.
The value to store for the environment variable.
Sets an interval that repeatedly executes a callback function after a specified delay. If a timeout with the same name already exists, it will be cleared before the new one is set.
A unique string identifier for this timeout.
The delay in milliseconds before the callback is executed.
The function to execute after the delay.
Sets the main view component for the application.
This component will be mounted to the DOM, in mountPoint.
Called once: each call sets up the keyboard (Tab, shortcuts) again.
The component to set as the main view.
Stores a string or number value in the browser's local storage. The value will be converted to a string before storage.
The key under which to store the value.
The value to store.
Stores an object as a JSON string in the browser's local storage.
The key under which to store the JSON value.
The object to serialize and store.
Sets a timeout that executes a callback function after a specified delay. If a timeout with the same name already exists, it will be cleared before the new one is set.
A unique string identifier for this timeout.
The delay in milliseconds before the callback is executed.
The function to execute after the delay.
Sets up WebSocket messaging for the application. All 'global' messages fired via the application will be sent over the WebSocket, and messages received from the WebSocket will be re-fired as 'global' messages.
Optionalpath: string
Optional WebSocket path. If not provided, it defaults to ws://hostname:port/ws.
OptionallooseCallback: () => void
A callback function to be executed when the WebSocket connection is closed unexpectedly.
StaticfireOptionalparams: anyStaticgetThe currency of the amounts: "EUR" unless setLocale gave another.
StaticgetThe locale of the formats: the one forced by setLocale, else the one of the language.
StaticgetThe name of the theme of the page, as setTheme got it: "" for the light theme
of x4, "dark" for its dark theme, or the name of a theme of the application.
StaticinstanceReturns the singleton instance of the Application.
The application instance.
StaticsetForces the locale of the formats of numbers, amounts and dates (formatNumber, formatMoney,
formatDate, formatDateTime), and the currency of the amounts. Without it, the locale is the one of the language (_tr.global.locale: "fr-FR"
for fr, "en-US" for en...) and the currency "EUR".
A field of type number is shown by the browser, in its own locale, whatever this one.
"fr-CH", "en-GB"...; null: the one of the language again
Optionalcurrency: string
"CHF", "USD"...; not given: the currency does not change
StaticsetSelects the theme of the page: the class x4theme-<name> on <html>, in place
of the one of the theme before.
"": the light theme of x4, the one by default: no class."dark": the dark theme of x4, like the theme Dark Modern of VS Code
(html.x4theme-dark in themes.scss).html.x4theme-<name>, with the variables of themes.scss it changes.the name of the theme; "" for the light theme.
The main application class, acting as a singleton. It manages the main view, environment variables, keyboard navigation, and provides utilities for local storage and WebSocket communication.
Assertions ensure only one instance of
Applicationcan exist.