TEN add-on system
Updated
Understand TEN add-ons, how the runtime loads them, and how apps discover extensions, extension groups, and protocols.
The TEN Framework uses add-ons as its basic software modules. Add-ons are self-contained components that implement specific functionality within the TEN Framework. All features and capabilities in a TEN application are built using these modular add-ons.
The TEN Framework supports the following types of add-ons:
- TEN extension - Implements core application logic and features
- TEN extension group - Groups multiple extensions for coordinated functionality
- TEN protocol - Handles communication protocols and data exchange
Loading add-ons
To load an add-on into the TEN runtime, you need:
-
Add-on name
The name must be globally unique within your TEN application. If you load multiple add-ons with the same name, the TEN runtime exhibits undefined behavior and may fail to load the second add-on properly.
-
Add-on folder location
Specify the directory path where the TEN runtime can find the add-on's files. The runtime uses this directory as the
base_dirto load configuration files such asmanifest.jsonandproperty.json.The add-on registration API attempts to detect this directory automatically. If automatic detection fails, you must explicitly specify the
base_dirpath. -
Add-on instance
Registering add-ons
You can register add-ons using one of the following methods:
-
Use the explicit registration API
Call the registration API to manually register the add-on's
base_dirwith the TEN runtime.Currently, only the standalone testing framework provides this API.
-
Use the designated directory structure
Place your add-ons in the
ten_packages/directory of your TEN application. The application automatically discovers and loads add-ons at startup when you organize them as follows:. └── ten_packages/ ├── extension/ │ ├── <extension_foo>/ │ └── <extension_bar>/ ├── extension_group/ │ └── <extension_group_x>/ └── protocol/ └── <protocol_a>/
