nx.js

nx.js

Namespaces

NamespaceDescription
SwitchThe Switch global object contains native interfaces to interact with the Switch hardware.

Classes

ClassDescription
AbortController-
AbortSignalEventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
AmbientLightSensorSensor implementation which returns the current light level or illuminance of the ambient light around the hosting device.
AudioThe Audio class provides audio playback functionality similar to the HTMLAudioElement in web browsers. It is implemented on top of the Web Audio API (AudioContext) — for low-level / game audio use the Web Audio classes directly.
AudioBufferA short audio asset residing in memory, created from an audio file using decodeAudioData(), or from raw data using createBuffer(). Once put into an AudioBuffer, the audio can be played by being passed into an AudioBufferSourceNode.
AudioBufferSourceNodeAn audio source consisting of in-memory audio data, stored in an AudioBuffer. This is the node to use when playing back one-shot or looping sounds (e.g. game sound effects and music).
AudioContextAn audio-processing graph built from audio modules (AudioNodes) linked together, rendered in real-time to the console's audio output.
AudioDestinationNodeThe end destination of an audio graph — the audio output device of the console. Obtained via ctx.destination; not user-constructible.
AudioNodeA generic interface for representing an audio processing module, the building block of an audio routing graph.
AudioParamAn audio-related parameter of an AudioNode, which can be set to a specific value or scheduled to change over time with sample-accurate automation.
AudioScheduledSourceNodeParent interface for several types of audio source node. Provides the start() / stop() scheduling methods and the ended event.
BaseAudioContextBase interface for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively.
BatteryManagerProvides information about the system's battery charge level. The navigator.getBattery() method returns a promise that resolves to a BatteryManager instance.
BlobA file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format.
BluetoothEntry point to Web Bluetooth functionality — available as navigator.bluetooth.
BluetoothCharacteristicPropertiesThe properties of a GATT characteristic.
BluetoothDeviceRepresents a single Bluetooth LE device, as returned by navigator.bluetooth.requestDevice().
BluetoothRemoteGATTCharacteristicA GATT characteristic — the fundamental unit of data exchange with a remote Bluetooth LE device.
BluetoothRemoteGATTServerThe GATT server of a remote Bluetooth LE device.
BluetoothRemoteGATTServiceA GATT service provided by a remote Bluetooth LE device.
BluetoothUUIDUtility for converting between 16/32-bit Bluetooth SIG aliases and canonical 128-bit UUID strings.
ByteLengthQueuingStrategyThis Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
CanvasGradient-
CanvasRenderingContext2D-
CloseEvent-
CompressionStream-
Console-
CountQueuingStrategyThis Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
CryptoBasic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.
CryptoKey-
CustomEvent-
DecompressionStream-
DOMException-
DOMMatrix-
DOMMatrixReadOnly-
DOMPointMDN Reference
DOMPointReadOnlyMDN Reference
DOMRectMDN Reference
DOMRectReadOnlyMDN Reference
ErrorEvent-
Event-
EventTargetEventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
FileA file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format.
FontFaceDefines the source of a font face, either a URL to an external resource or a buffer, and font properties such as style, weight, and so on. For URL font sources it allows authors to trigger when the remote font is fetched and loaded, and to track loading status.
FontFaceSetManages the loading of font-faces and querying of their download status.
FormData-
GainNodeAn AudioNode which applies a (possibly automated) gain to its input — e.g. volume control and fades.
GamepadDefines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id.
GamepadButtonDefines an individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device.
GamepadEvent-
GamepadHapticActuatorRepresents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.
HeadersThis Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing.
ImageThe Image class is the spiritual equivalent of the HTMLImageElement class in web browsers. You can use it to load image data from the filesytem or remote source over the network. Once loaded, the image may be drawn onto the screen context or an offscreen canvas context using ctx.drawImage().
ImageBitmapRepresents a bitmap image which can be drawn to a <canvas> without undue latency. It can be created from a variety of source objects using the createImageBitmap() function.
ImageData-
KeyboardEvent-
MessageEvent-
NavigatorThe Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.
OfflineAudioCompletionEventThe event dispatched on an OfflineAudioContext when rendering completes.
OfflineAudioContextAn AudioContext which doesn't render the audio graph to the audio output device, but instead generates it (as fast as possible) into an AudioBuffer.
OffscreenCanvas-
OffscreenCanvasRenderingContext2D-
Path2DDeclares a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired.
PerformanceNote: performance.now() currently uses Date.now() internally, providing millisecond resolution. A future version may use the Switch's svcGetSystemTick for sub-millisecond precision once a native binding is available.
PerformanceEntry-
PerformanceMark-
PerformanceMeasure-
PromiseRejectionEvent-
ReadableByteStreamControllerMDN Reference
ReadableStreamThis Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
ReadableStreamBYOBReaderMDN Reference
ReadableStreamBYOBRequestMDN Reference
ReadableStreamDefaultControllerMDN Reference
ReadableStreamDefaultReaderMDN Reference
Request-
ResponseClass representing a HTTP response.
ScreenEventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
SensorSensor is the base class for all the other sensor interfaces. This interface cannot be used directly. Instead it provides properties, event handlers, and methods accessed by interfaces that inherit from it.
StereoPannerNodeAn AudioNode which pans its input across the stereo field using the equal-power panning algorithm.
Storage-
SubtleCrypto-
TerminalA canvas-backed terminal. Wraps a headless xterm.js instance for terminal state/scrollback/ANSI parsing, and renders the cell grid into an OffscreenCanvas using the Canvas 2D API with the bundled Geist Mono font. Feed it ANSI text with write(); the rendered canvas is available as canvas.
TextDecoderThe TextDecoder interface represents a decoder for a specific text encoding. The implementation in nx.js only supports "utf-8" decoding.
TextEncoderTextEncoder takes a UTF-8 encoded string of code points as input and return a stream of bytes.
TouchA single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad.
TouchEvent-
TouchListA list of contact points on a touch surface. For example, if the user has three fingers on the touch surface (such as a screen or trackpad), the corresponding TouchList object would have one Touch object for each finger, for a total of three entries.
TransformStreamMDN Reference
TransformStreamDefaultControllerMDN Reference
UIEvent-
URLThe URL interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL.
URLSearchParamsMDN Reference
USBEntry point for WebUSB functionality, available as navigator.usb.
USBAlternateInterfaceA USB alternate interface descriptor.
USBConfigurationA USB configuration descriptor.
USBDeviceA USB device returned from USB.requestDevice.
USBEndpointA USB endpoint descriptor exposed by USBAlternateInterface.
USBInterfaceA USB interface descriptor.
VideoThe Video class provides video playback functionality similar to the HTMLVideoElement in web browsers. Since nx.js has no DOM, the video does not render itself — the application explicitly draws the current frame each render pass, just like drawing a <video> onto a <canvas>:
VirtualKeyboard-
WebGL2RenderingContextThe WebGL2 rendering context for the screen canvas, backed by a real OpenGL ES 3 context on the Switch GPU. Acquire it with screen.getContext('webgl2').
WebGLActiveInfoInformation about a uniform or attribute, returned by gl.getActiveUniform() / gl.getActiveAttrib().
WebGLBufferOpaque handle to a WebGL buffer object (gl.createBuffer()).
WebGLFramebuffer-
WebGLProgram-
WebGLQuery-
WebGLRenderbuffer-
WebGLSampler-
WebGLShader-
WebGLShaderPrecisionFormat-
WebGLSync-
WebGLTexture-
WebGLTransformFeedback-
WebGLUniformLocation-
WebGLVertexArrayObject-
WebSocketThe WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
WindowThe Window class represents the global scope within the application.
WritableStreamThis Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
WritableStreamDefaultControllerThis Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
WritableStreamDefaultWriterThis Streams API interface is the object returned by WritableStream.getWriter() and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink.

Interfaces

InterfaceDescription
AddEventListenerOptions-
AesCbcParams-
AesCtrParams-
AesDerivedKeyParams-
AesGcmParams-
AesKeyGenParams-
AesXtsParams-
Algorithm-
AmbientLightSensorOptions-
ArrayBufferView-
AudioBufferOptions-
AudioBufferSourceOptions-
AudioContextOptions-
AudioNodeOptions-
BlobPropertyBag-
BluetoothLEScanFilter-
BluetoothManufacturerDataFilter-
CloseEventInit-
ConsoleOptionsOptions for a Console. In addition to the optional print/printErr sinks, the canvas-backed terminal can be styled via TerminalOptions (theme colors, font size, scrollback, cursor, etc.).
ConsoleThemeColor theme for the on-screen terminal. Supports the standard ANSI 16-color palette plus foreground, background, and cursor colors.
CryptoKeyPair-
CustomEventInit-
DOMMatrix2DInit-
DOMMatrixInit-
DOMPointInit-
DOMRectInit-
EcdhKeyDeriveParams-
EcdsaParams-
EcKeyGenParams-
EcKeyImportParams-
ErrorEventInit-
EventInit-
EventListener-
EventListenerObject-
EventListenerOptions-
EventModifierInit-
FilePropertyBag-
FontFaceDescriptors-
FrameRequestCallback-
GainOptions-
GamepadEffectParameters-
GamepadEventInit-
HkdfParams-
HmacImportParams-
HmacKeyGenParams-
ImageBitmapOptions-
ImageDataSettings-
ImageEncodeOptions-
ImportMetaThe import.meta meta-property exposes context-specific metadata to a JavaScript module. It contains information about the module, such as the module's URL.
JsonWebKey-
KeyboardEventInit-
MessageEventInit-
NativeFileSourceDescriptor a native-file-source ReadableStream carries.
OfflineAudioCompletionEventInit-
OfflineAudioContextOptions-
PromiseRejectionEventInit-
QueuingStrategy-
QueuingStrategyInit-
QueuingStrategySize-
ReadableStreamGenericReader-
ReadableStreamIteratorOptions-
ReadableStreamReadDoneResult-
ReadableStreamReadValueResult-
RequestDeviceOptions-
RequestInitOptions accepted by fetch() and the Request constructor.
ResponseInit-
StereoPannerOptions-
StreamPipeOptions-
TerminalOptions-
TextDecodeOptions-
TextEncoderEncodeIntoResult-
TextMetrics-
TouchEventInit-
TouchInit-
Transformer-
TransformerFlushCallback-
TransformerStartCallback-
TransformerTransformCallback-
UIEventInit-
Uint8ArrayFromBase64Options-
Uint8ArraySetFromResult-
Uint8ArrayToBase64Options-
UnderlyingByteSource-
UnderlyingDefaultSource-
UnderlyingSink-
UnderlyingSinkAbortCallback-
UnderlyingSinkCloseCallback-
UnderlyingSinkStartCallback-
UnderlyingSinkWriteCallback-
UnderlyingSource-
UnderlyingSourceCancelCallback-
UnderlyingSourcePullCallback-
UnderlyingSourceStartCallback-
USBControlTransferParameters-
USBDeviceFilter-
USBDeviceRequestOptions-
USBInTransferResult-
USBOutTransferResult-
WebGLContextAttributes-

Type Aliases

Variables

VariableDescription
bluetoothThe shared Bluetooth instance (also exposed as navigator.bluetooth).
consoleThe global console object contains functions for printing text to the screen, which can be useful for text-based applications, and is also useful for debugging.
cryptoThe global crypto property returns the Crypto object associated to the global object. This object allows your application to access to certain cryptographic related services.
fontsContains the available fonts for use on the screen Canvas context.
kNativeDecompressSetup-
kNativeFileSourceInternal tags enabling a transparent native fast path for the file.stream().pipeThrough(new DecompressionStream(fmt)) pattern.
localStoragelocalStorage is a Storage instance which persists to the system's Save Data filesystem.
navigator-
performance-
screen-
stopImmediatePropagationFlagWeakSet tracking events whose stopImmediatePropagation() was called. Used by EventTarget.dispatchEvent() to halt listener iteration.
usbThe shared USB instance, also exposed as navigator.usb.
window-

Functions

FunctionDescription
addEventListener-
atobDecodes a string of data which has been encoded using Base64 encoding.
btoaCreates a Base64-encoded ASCII string from a binary string (i.e., a string in which each character in the string is treated as a byte of binary data).
cancelAnimationFrameCancels an animation frame request previously scheduled through a call to requestAnimationFrame().
clearIntervalThe global clearInterval() method clears a timer set with the setInterval() method.
clearTimeoutThe global clearTimeout() method clears a timer set with the setTimeout() method.
consoleFontAvailableRegister the bundled Geist Mono font (from the nx.js NRO's own RomFS) into the canvas font set. Returns false when the font can't be loaded — which is the signal that the canvas-backed console is unavailable (e.g. the host test binary, which has no nxjs: mount and no display), so callers fall back to the native libnx console ($.print). The result is cached (incl. failure) so the per-log check is cheap and doesn't re-readFileSync on the host.
createAudioBufferAdopt already-allocated channel data (e.g. from decodeAudioData()) without copying.
createAudioParamCreate an AudioParam bound to native param storage, addressed as (node handle, param index).
createImageBitmapCreates a bitmap from a given source, optionally cropped to contain only a portion of that source. This function accepts a variety of different image sources, and returns a Promise which resolves to an ImageBitmap.
dispatchEventDispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
fetchThe global fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response is available.
getSharedAudioContextThe shared media-element AudioContext (created on first use).
queueMicrotaskQueues a microtask to be executed at a safe time prior to control returning to the runtime's event loop.
removeEventListenerRemoves the event listener in target's event listener list with the same type, callback, and options.
requestAnimationFrameTells the application that you wish to perform an animation. The application will call the supplied callback function prior to the next repaint.
setContextStateTransition the context state and fire statechange if it changed.
setIntervalThe global setInterval() method repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
setTimeoutThe global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.
trackActiveSource-

On this page