Open a terminal at the location you want your application to be created. A subfolder will be created for you. Then run the following command
$ trinity-cli new
Provide a few information such as your app name, package name, author information, and a new folder will be created with your capsule.
The created application uses the ionic framework. It simply embeds an additional manifest.json file to be considered as a elastOS application.
We offer a few app templates, for example on Angular there is a full demo template
For more detail about Ionic, please visit https://ionicframework.com/docs .
You can build any kind of ionic-based application in Elastos, as the whole ionic framework is available. In addition, Elastos plugins are available too, such as carrier, hive, or access to payments and digital identities (DID).
In case the default capsule you’ve created does not include typescript types for elastOS plugins, you may have to add them by yourself:
$ npm i @elastosfoundation/trinity-types
Make sure your tsconfig.json contains the following parts:
"compilerOptions": {
...
"typeRoots": [
"node_modules/@types",
"node_modules/@elastosfoundation"
],
"types": [
"node",
"trinity-types"
],
...
}
Then in your application, you can use it this way:
// Global variable
declare let appManager: AppManagerPlugin.AppManager;
// In a method
appManager.sendIntent(...);
Checklist:
Enter your app’s folder in a terminal then run the following command:
$ trinity-cli run -p android --nodebug
That will package your application as a EPK file, send it to your device, install it inside elastOS, and run it.
After your app is launched inside elastOS, you can directly edit your app content from its src/ folder. Changes will automatically reload in elastOS.
A manifest.json file is created by default in your elastOS capsule project. You can manually edit it whenever needed. The elastOS manifest format is fully described in the elastOS manifest guide.