nx.js
NamespacesSwitchVariables

entrypoint

const entrypoint: string = $.entrypoint

String value of the entrypoint JavaScript file that was evaluated. It is the base URL used to resolve relative fetch() / Image / Audio paths.

It is resolved in the following order:

  • If a second launch argument (Switch.argv[1]) was provided (a "bootstrap" launch, where a thin launcher hands the nx.js runtime an app to run):
    • a .nro path: its embedded RomFS is mounted and the value is "romfs:/main.js".
    • any other path (typically a .js file): the value is that path as given.
  • Otherwise (a standalone app): if a main.js is present in the application's own RomFS, the value is "romfs:/main.js". Failing that, it is the path of the .nro on the SD card with .nro replaced by .js.

Note: the nx.js runtime's own files (e.g. its source map) are mounted separately under nxjs: so that romfs: always refers to the running app.

Examples

"romfs:/main.js"
"sdmc:/switch/my-app.js"

On this page