$
Namespace for common DOM manipulation operations. For the query selector function, see {@link $(...)}
Functions
AsyncWebRequest
Make a web request.
Example
Parameters
Name | Type | Description |
url | string | No description provided. |
options | { complete: { (data: { responseText: string; statusText: string; }): void; }; type: DELETE | GET | HEAD | OPTIONS | POST | PUT; } (optional) | No description provided. |
See also
CancelScheduled
Cancel a scheduled function.
Example
Parameter
Name | Type | Description |
event | number | No description provided. |
See also
CompressString
Compresses the given string, and encodes result in base64.
Parameter
Name | Type | Description |
str | string | No description provided. |
CreatePanel
Create a new panel.
Example
Parameters
Name | Type | Description |
type | T | No description provided. |
parent | GenericPanel | No description provided. |
id | string | No description provided. |
properties | Record<string, unknown> (optional) | No description provided. |
See also
DbgIsReloadingScript
Call during JS startup code to check if script is being reloaded
Parameter
Name | Type | Description |
...args | any[] | No description provided. |
DecompressString
Decompresses the given base64 encoded input into a string.
Parameter
Name | Type | Description |
str | string | No description provided. |
DefineEvent
Define an event.
Examples
Parameters
Name | Type | Description |
event | string | The event name. |
argscount | number | The number of arguments that this event takes. |
argsdesc | string (optional) | An optional description for the event arguments. |
desc | string (optional) | An option description for the event. |
See also
DefinePanelEvent
Appears to be identical to $.DefineEvent(...). This function is not used anywhere in Momentum UI.
Examples
Parameters
Name | Type | Description |
event | string | The event name. |
argscount | number | The number of arguments that this event takes. |
argsdesc | string (optional) | An optional description for the event arguments. |
desc | string (optional) | An option description for the event. |
See also
DispatchEvent
Dispatch an event.
Example
Parameters
Name | Type | Description |
event | T | No description provided. |
...args | T extends keyof GlobalEventNameMap ? Parameters<GlobalEventNameMap[T<T>]> : any[] | No description provided. |
See also
DispatchEventAsync
Dispatch an event to occur later.
Parameter
Name | Type | Description |
...args | any[] | No description provided. |
Each
DEPRECATED: This was probably added by Valve before .forEach was added to JavaScript. There's no benefit to this over .forEach.
Call a function on each given item. Functionally identical to (...).forEach(...).
Parameters
Name | Type | Description |
items | T[] | No description provided. |
callback | { (item: T, index: number): void; } | No description provided. |
FindChildInContext
Find an element within the current panel context.
This function first calls FindChildInLayoutFile, and if that fails, search other panels in the current context.
Parameter
Name | Type | Description |
...args | any[] | No description provided. |
GetContextObject
Get the current Javascript context object.
Scripts (non-modules) run in this context directly. Any variables defined in the outermost scope of those scripts are accessible by one-another and are effectively properties of that context object, as well as event handlers and <script> blocks in XML.
Modules run in an encapsulated context, and have no access to the outside context without use of this function. To expose values from a module, call this function and set properties on the returned object.
GetContextPanel
Gets the root panel of the current Javascript context.
Example
See also
HTMLEscape
Converts str, which must be 2048 utf-8 bytes or shorter, into an HTML-safe version.
If truncate=true, too long strings will be truncated instead of throwing an exception.
Parameters
Name | Type | Description |
str | string | No description provided. |
truncate | boolean (optional) | No description provided. |
Language
Get the current language
LoadKeyValues3File
Load a named key values file and return as JS object.
Parameter
Name | Type | Description |
url | string | The path to the file, including the extension, relative to the content folder root. |
LoadKeyValuesFile
Load a named key values file and return as JS object.
Example
Parameter
Name | Type | Description |
url | string | The path to the file, including the extension, relative to the content folder root. |
See also
Localize
Localizes a string.
Example
Parameter
Name | Type | Description |
str | string | No description provided. |
See also
LocalizeSafe
Localize a string, but return empty string if the localization token is not found
Parameter
Name | Type | Description |
str | string | No description provided. |
Msg
Log a message
Parameter
Name | Type | Description |
...messages | any[] | No description provided. |
PlaySoundEvent
Plays the specified soundscript.
Parameter
Name | Type | Description |
sound | string | No description provided. |
RegisterConVarChangeListener
Register a handler for whenever a convar changes
Parameters
Name | Type | Description |
convar | string | No description provided. |
callback | { (value: string): void; } | No description provided. |
RegisterEventHandler
Register an event handler for an existing event.
Example
Parameters
Name | Type | Description |
event | T | No description provided. |
context | string | GenericPanel | No description provided. |
callback | T extends keyof PanelEventNameMap ? PanelEventNameMap[T<T>] : T extends keyof GlobalEventNameMap ? GlobalEventNameMap[T<T>] : never | No description provided. |
See also
RegisterForUnhandledEvent
Register a handler for an event that is not otherwise handled.
Example
Parameters
Name | Type | Description |
event | T | No description provided. |
callback | GlobalEventNameMap[T] | No description provided. |
See also
RegisterKeyBind
Register a key binding
Parameters
Name | Type | Description |
panel | GenericPanel | No description provided. |
key | string | No description provided. |
event | string | Func<any[], void> | No description provided. |
Schedule
Schedule a function to be called later
Parameters
Name | Type | Description |
time | number | No description provided. |
callback | Func<any[], void> | No description provided. |
StopSoundEvent
Stops a sound event by the specified uuid returned from a previous call to PlaySoundEvent. fadetime is optional.
Parameters
Name | Type | Description |
guid | number | No description provided. |
fadetime | number (optional) | No description provided. |
SystemInDarkMode
Returns whether the OS's theme is in dark mode
UnregisterConVarChangeListener
Unregister a handler for a convar change
Parameter
Name | Type | Description |
id | number | No description provided. |
UnregisterEventHandler
Remove an event handler
Parameters
Name | Type | Description |
event | T | No description provided. |
context | GenericPanel | No description provided. |
eventHandler | number | No description provided. |
UnregisterForUnhandledEvent
Remove an unhandled event handler
Parameters
Name | Type | Description |
event | T | No description provided. |
eventHandler | number | No description provided. |
UrlDecode
Decodes str, which must be 2048 utf-8 bytes or shorter, from URL-encoded form.
Parameter
Name | Type | Description |
...args | any[] | No description provided. |
UrlEncode
Encodes str, which must be 2048 utf-8 bytes or shorter, into URL-encoded form.
Parameter
Name | Type | Description |
...args | any[] | No description provided. |
Warning
Log a warning
Parameter
Name | Type | Description |
...args | any[] | No description provided. |