Skip to content

os

make_transform() function

Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.

clean_transforms() function

Force an update on all transforms to remove dangling references or perform house-keeping.

platform() function

Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.

arch() function

Return the CPU architecture string for this system (e.g. 'x64', 'arm64').

totalmem() function

Return the total system RAM in bytes.

freemem() function

Return the amount of free system RAM in bytes, if known.

hostname() function

Return the system's hostname, or an empty string if not available.

version() function

Return the OS or kernel version string, if the platform provides it.

kill() function

Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.

exit() function

Exit the application with the specified exit code.

now() function

Return current time (in seconds as a float) with high resolution.

openurl() function

Open the provided URL in the default web browser, if possible.

make_timer() function

Create a new timer object that will call a specified function after a certain delay.

update_timers() function

Advance all timers by the provided time delta (in seconds).

sleep() function

Block execution for the specified number of seconds.

battery_pct() function

Return the battery level (percentage) or negative if unknown.

battery_voltage() function

Return the current battery voltage in volts, if available.

battery_seconds() function

Return the estimated remaining battery time in seconds, or negative if unknown.

power_state() function

Return a string describing power status: 'on battery', 'charging', 'charged', etc.

on() function

Register a global callback for certain engine-wide or system-level events.

rt_info() function

Return internal QuickJS runtime info, such as object counts.

rusage() function

Return resource usage stats for this process, if the platform supports it.

mallinfo() function

Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.

env() function

Fetch the value of a given environment variable, or undefined if it doesn't exist.

system() function

Execute a shell command using the system() call. Returns the command's exit code.