NssUiApi basics
This directory contains the UI components for the NSS libraries.
Simple: ES6 module import
In this example we import the NssAudio component directly via ES6 module import.
This is the easiest way to import a component.
Load components via api
Alternatively you can load ui components via the NssUiApi
component. This enables you to load multiple ui components at once, waiting for all components to be loaded and/or loading components dynamically.
Alternative for local development
Only for developers who want to test the components locally in the browser (e.g. Chrome) without running a REDM server.
Create a file called
nss_ui_api.js
into the root of your html script folder. This file will be a wrapper to decide automatically if the CFX browser is available (we are in a RedM client) or not (we are in a normal browser).Add the following code to the wrapper file:
Replace all
[YOUR_RELATIVE_PATH_TO]
placeholders with the relative paths to thenss_libs
folder.Go into your main javascript file (e.g.
app.js
orindex.js
) and add the following code to import theNssUiApi
:Replace the placeholders with the related values.
[YOUR_RESCOURCE_NAME]
is the name of your resource.
Last updated