Developing LitElement Widgets
This section describes how you can use LitElement framework to develop your widgets.
#
Creating the Project#
About this taskYou can create a LitElement Web Component widget. The following instruction provides an example of creating a demoComp.js widget.
#
ProcedureCreate an empty project folder with an empty demoComp.js file inside.
From the project folder, run the following command in your terminal ⁄ console:
Follow the commands and enter the details when prompted. In this step you create a package.json file.
Install Lit running the following NPM command:
- Add the following code to the demoComp.js project file:
- Set up class name and define it as custom element:
- Add the script of your widget to the DemoComp class. For testing purposes, you can add the following code:
- If you want to use the Neo CSS styles, which are recommended for compatibility, specify a location to the Neo CSS file.
#
Next stepWhen your project is ready, you must build it for later use.
#
Building the Project#
About this taskYou must build the project to use your widget in Avaya Workspaces.
#
Procedure- In the root project folder, create a webpack.config.js file with the following contents:
- Add the following build script into the package.json file:
- Install the webpack CLI and the webpack itself:
- Build the project running the command that creates the dist folder with the bundled .js file for your Web Component.
#
Next stepWhen your project is bundled and built, continue configuring the widget JSON file that you can import in the Widget Manager.