Files
cell/docs/api/modules/os.md
2025-02-10 09:48:59 -06:00

102 lines
2.6 KiB
Markdown

# os
### make_transform() <sub>function</sub>
Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.
### clean_transforms() <sub>function</sub>
Force an update on all transforms to remove dangling references or perform house-keeping.
### platform() <sub>function</sub>
Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.
### arch() <sub>function</sub>
Return the CPU architecture string for this system (e.g. 'x64', 'arm64').
### totalmem() <sub>function</sub>
Return the total system RAM in bytes.
### freemem() <sub>function</sub>
Return the amount of free system RAM in bytes, if known.
### hostname() <sub>function</sub>
Return the system's hostname, or an empty string if not available.
### version() <sub>function</sub>
Return the OS or kernel version string, if the platform provides it.
### kill() <sub>function</sub>
Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.
### exit() <sub>function</sub>
Exit the application with the specified exit code.
### now() <sub>function</sub>
Return current time (in seconds as a float) with high resolution.
### openurl() <sub>function</sub>
Open the provided URL in the default web browser, if possible.
### make_timer() <sub>function</sub>
Create a new timer object that will call a specified function after a certain delay.
### update_timers() <sub>function</sub>
Advance all timers by the provided time delta (in seconds).
### sleep() <sub>function</sub>
Block execution for the specified number of seconds.
### battery_pct() <sub>function</sub>
Return the battery level (percentage) or negative if unknown.
### battery_voltage() <sub>function</sub>
Return the current battery voltage in volts, if available.
### battery_seconds() <sub>function</sub>
Return the estimated remaining battery time in seconds, or negative if unknown.
### power_state() <sub>function</sub>
Return a string describing power status: 'on battery', 'charging', 'charged', etc.
### on() <sub>function</sub>
Register a global callback for certain engine-wide or system-level events.
### rt_info() <sub>function</sub>
Return internal QuickJS runtime info, such as object counts.
### rusage() <sub>function</sub>
Return resource usage stats for this process, if the platform supports it.
### mallinfo() <sub>function</sub>
Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.
### env() <sub>function</sub>
Fetch the value of a given environment variable, or undefined if it doesn't exist.
### system() <sub>function</sub>
Execute a shell command using the system() call. Returns the command's exit code.