Runtime Configuration
These functions allow you to configure runtime properties and attach custom data to a runtime instance.JS_SetRuntimeInfo
Sets an informational string for the runtime.Parameters
JSRuntime *
required
The runtime to configure.
const char *
required
Informational string describing the runtime. The pointer must remain valid for the lifetime of the runtime.
Description
Attaches a descriptive string to the runtime for debugging or identification purposes. This is useful when working with multiple runtimes to distinguish them in logs or debugging output.Example
JS_SetRuntimeOpaque
Attaches custom user data to a runtime.Parameters
JSRuntime *
required
The runtime to attach data to.
void *
Pointer to user-defined data. Can be
NULL.Description
Stores a user-defined pointer in the runtime. This is useful for:- Associating application-specific data with the runtime
- Passing context information to C functions
- Implementing runtime-specific callbacks
- Storing configuration or state data
Example
JS_GetRuntimeOpaque
Retrieves custom user data from a runtime.Parameters
JSRuntime *
required
The runtime to retrieve data from.
Returns
void *
The user-defined pointer previously set with
JS_SetRuntimeOpaque(), or NULL if none was set.