Development Environment
The first step in setting up your development environment will be to download or use NPM to install the agentM library which can be found here the docs.meld.cx site.
There you can find the AgentM.js which exposes the agentM library as an object on the window i.e. window.Agent and the NPM Module which can be imported at utilised like any other NPM module.
Once you have downloaded the agentM library you can include it in the head of your application index.html page like so.
<head>
<title>AgentM Library demo</title>
<script src="Agent.js" type="text/javascript"></script>
</head>
Once this library has been included into your application all of the agentM library APIs will be available under the window.Agent object
If you haven’t done so already we recommend you to install NodeJS onto your computer as many of the tools we use rely exclusively on this being available.
Our recommended version of NodeJS is 9.x you can find it here and then locate the appropriate version for your development computers operating system.
Once you have downloaded and install NodeJS install the following packages.
http-server
A basic http server great for serving a web page directly from your computer.
Run the following command to install http-server from inside your terminal or command prompt:
npm install -g http-server
You may need to close and open the terminal/command prompt in order for the http-server app to be available.
You can spawn a simple http server on your computer using the following command
http-server ./folder-to-serve -p 8080
You should see something similar to the following:
Starting up http-server, serving ./folder-to-serve
Available on:
http://127.0.0.1:8080
http://192.168.0.171:8080
http://172.16.109.1:8080
http://192.168.131.1:8080
Hit CTRL-C to stop the server
This will mean that you can now access the files being served from that folder on your chrome os device.
Running your dev App
You can create a URL application inside the meldCX console and point it directly to the web server you just created. See here for an article on creating a URL application in the meldCX console.
Running your Packaged App
Scheduling a Packaged Application is super easy, you can find instructions on scheduling packaged apps here.
Debugging your Application
Vorlon is an excellent tool developed by Microsoft, it provides a Chrome dev tools like experience and is used heavily by the meldCX team and their clients for developing applications on the meldCX platform.
You can install Vorlon by running the following command in your terminal / command prompt.
npm install -g vorlon
Once you have installed Vorlon you can start the server by running the following command in your terminal / command prompt
vorlon
Vorlon should start and you should see something similar to the following:
2019-2-11 11:24:41 - info: Vorlon.js PROXY listening at 0.0.0.0:5050
2019-2-11 11:24:41 - info: Vorlon.js SERVER listening at 0.0.0.0:1337
Once you see the above you can navigate to http://127.0.0.1:1337/ in your browser (preferably chrome browser). You should see something similar to the following.
Once you have the Vorlon server you can insert the Vorlon script into the head of your application
<head>
<title>AgentM Library demo</title>
<script src="Agent.js" type="text/javascript"></script>
<script src="http://${your-public-lan-ip}:1337/vorlon.js" type="text/javascript"></script>
</head>
Note: Please replace your-public-lan-ip with the IP of your computer of your computer, you should be able to find this in the console output of the http-server application.
If your application is already loaded and visible on your chrome device you can navigate to the health tab in the meldCX console and click "CLEAR CACHE" to force the webview to reload your application.
You should then see your device become visible in the Vorlon web page (http://127.0.0.1:1337)
You can then test any of the meldCX agentM library commands by typing them into the console entry bar at the bottom.
You are now set to begin debugging your application.
Note: An update to the meldCX console is coming soon and will allow the above process to be done with a single click in the meldCX console securely over the internet.
Comments
0 comments
Please sign in to leave a comment.