Applications
Interacting with installed applications
The Switch.Application
API is used to interact with installed applications (game titles) and/or homebrew apps (.nro
files).
Instances of Switch.Application
can read the app's title, author information, and other metadata. It is also possible to retrieve a JPEG format image of the title's box art (256 x 256 format).
Additionally, working with Save Data is preferred to be done by first retrieving the Switch.Application
instance which your app is interested in working with.
Instance of current app
Use the special getter Switch.Application.self
to retrieve an instance of Switch.Application
which represents
the currently running nx.js application.
Using Switch.Application.self
considers the various methods in which a Switch
homebrew app can be launched, and loads the correct application metadata accordingly.
Iterate installed applications
The Switch.Application
class can be used as an iterator for the purposes of iterating over the installed titles.
This can be useful for i.e. rendering a title launcher screen or gathering information about which titles are currently
installed.
By Title ID
If you know the specific title ID for an installed application, use the new Switch.Application(id)
constructor to create an
instance of the class:
If the specified title is not currently installed on the system, then the accessor methods will throw an error.
By NRO blob
After reading a homebrew .nro
file into memory, it is possible to use the new Switch.Application(nroBlob)
constructor to create
and instance of the class:
The app.launch()
function is currently not implemented for instances of Switch.Application
which were created from a homebrew .nro
file. This may change in the future - see #125.