Namespaces
Switch
The Switch
global object contains native interfaces to interact with the Switch hardware.
Index
Classes
Class | Description |
---|---|
Album | The Switch.Album class allows for interacting with the Switch's photo gallery, providing access to the screenshots / video recordings that the user has saved. |
AlbumFile | Represents a file within a Switch.Album content store, which is either a screenshot (JPEG image) or a screen recording (MP4 movie). |
Application | Represents an installed application (game) on the console, or a homebrew application (.nro file). |
Env | A Map-like object providing methods to interact with the environment variables of the process. |
FileSystem | - |
FsFile | The Switch.FsFile class is a special implementation of the global File class, which interacts with the system's physical file system. |
IRSensor | The IRSensor class is a Sensor subclass. When the sensor is activated, the controller's IR (infrared) camera is enabled, allowing the application to get the image data for each frame of the camera. |
Profile | Represents a user profile that exists on the system. |
SaveData | Represents a "save data store". |
Server | EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. |
Socket | The Socket class represents a TCP connection, from which you can read and write data. A socket begins in a connected state (if the socket fails to connect, an error is thrown). While in a connected state, the socket’s ReadableStream and WritableStream can be read from and written to respectively. |
SocketEvent | - |
Interfaces
Interface | Description |
---|---|
FsFileOptions | Options object for the Switch.file() function. |
FsFileStreamOptions | Options object for the Switch.FsFile#stream() function. |
IRSensorInit | - |
InspectOptions | - |
ListenOptions | Specifies the port number and optional IP address for creating a TCP server. |
NetworkInfo | - |
SaveDataCreationInfoBase | - |
SaveDataCreationInfoWithNacp | - |
SaveDataFilter | - |
SocketAddress | Specifies the port number and optional hostname for connecting to a remove server over the network. |
SocketEventInit | - |
SocketInfo | - |
SocketOptions | - |
Stats | - |
Versions | - |
Vibration | - |
Type Aliases
Type alias | Description |
---|---|
PathLike | - |
ProfileUid | - |
SaveDataCreationInfo | - |
SecureTransportKind | - |
Variables
Variable | Description |
---|---|
argv | Array of the arguments passed to the process. Under normal circumstances, this array contains a single entry with the absolute path to the .nro file. |
entrypoint | String value of the entrypoint JavaScript file that was evaluated. If a main.js file is present on the application's RomFS, then that will be executed first, in which case the value will be romfs:/main.js . Otherwise, the value will be the path of the .nro file on the SD card, with the .nro extension replaced with .js . |
env | A Map-like object providing methods to interact with the environment variables of the process. |
version | An Object containing the versions numbers of nx.js and all supporting C libraries. |
Functions
Function | Description |
---|---|
appletType | Returns the "applet type" of the running application. |
chdir | Changes the current working directory to the specified path. |
connect | Creates a TCP connection to the specified address . |
cwd | Returns the current working directory as a URL string with a trailing slash. |
exit | Signals for the nx.js application to exit. The global "unload" event will be invoked after the event loop has stopped. |
file | Returns a Switch.FsFile instance for the given path . |
inspect | - |
listen | Creates a TCP server bound to the specified port number. |
mkdirSync | Creates the directory at the provided path , as well as any necessary parent directories. |
networkInfo | - |
operationMode | Returns the current "operation mode" of the device. |
readDirSync | Synchronously returns an array of the file names within path . |
readFile | Returns a Promise which resolves to an ArrayBuffer containing the contents of the file at path . |
readFileSync | Synchronously returns an ArrayBuffer containing the contents of the file at path . |
remove | Removes the file or directory recursively specified by path . |
removeSync | Synchronously removes the file or directory recursively specified by path . |
renameSync | Synchronously renames a file or directory. |
resolveDns | Performs a DNS lookup to resolve a hostname to an array of IP addresses. |
setMediaPlaybackState | Set media playback state. |
stat | Returns a Promise which resolves to an object containing information about the file pointed to by path . |
statSync | - |
writeFileSync | Synchronously writes the contents of data to the file at path . |