index.jsx file. The index.jsx file is called the “composition root”. The baseline composition’s index.jsx file can be used an example of what any custom versions should look like.
Your index.jsx file must use the newer JavaScript module standard, i.e. import/export statements. (The older Node.js style of require and module.exports will not work.)
A package.json is not required in the folder supplied for a live stream or recording. VCS uses runtime inspection to discover the composition’s features, and importing third party packages from npm isn’t supported. (You can still include a package.json for metadata, if you want.)
Composition root entry points
The composition root must export two entry points:- The composition interface, a JSON object:
- The root component — a React functional component — which must be the default export:
- The composition interface for the VCS baseline composition
- The root composition for the VCS baseline composition
The composition interface format
The object exported ascompositionInterface may contain the following properties:
displayMeta: Object
name: String- User-visible name for the composition (shown in the simulator UI)
description: String- User-visible description of the composition
params: Array of ParamDesc
ParamDesc: Objectid: String (Mandatory)- An internal ID for this param
- This ID can be used to look up the param’s value at runtime
type: String (enum) (Mandatory)- Allowed values are:
boolean: Rendered as a checkbox in the simulator UInumber: Rendered as a number field (with increment/decrement buttons) in the simulator UItext: Rendered as a text field in the simulator UIenum: Rendered as a pop-up menu button (a HTML<select>element) in the simulator UI- When using this type, include the
valuesproperty
- When using this type, include the
- Allowed values are:
defaultValue:any, depends ontype(Optional)values: Array of strings (Optional)- Only applies to the
enumtype
- Only applies to the
step: Number (Optional)- Only applies to the
numbertype - Sets the increment/decrement step for the simulator UI
- Only applies to the
Continue reading our additional
Core concepts pages: