MeldCX Developer Reference


Getting started

MeldCX provides a number of libraries to help you get your application development underway quickly and easily.

The MeldCX AgentM Library provides you with the ability to interact with your device and provides flexible methods for accessing device configuration, peripherals, power settings and misc others.

Standalone Library

To use the AgentM Library without having to configure NPM, Webpack and Babel you can use the standalone library that will attach the AgentM Library to the window via the window.Agent object.

  1. Download the AgentM library from here.
  2. Insert the AgentM library into the head of your index.html file
<html>
    <head>
        <title>AgentM Library demo</title>
        <script src="Agent.js" type="text/javascript"></script>
    </head>
    <body>
    ...
    </body>
</html>
  1. The AgentM library will now be visible on the window.Agent object.

Example Usage

// Wait for the agent to be ready
window.Agent.onReady(() => {
    // You can now use any of the Agent library functions

    ...
});

Note: The AgentM library will not initialise when used outside of the AgentM application.

Node Packaged Module

To use the AgentM Library in conjunction with NPM, ensure that you have initialised your NPM package.json file via the npm init command.

After you have initialised the NPM package.json file you can install the agent library by running npm install @meldcx/agent@latest.

Once you have installed the AgentM library you can include the library into your application via CommonJS require const Agent = require('@meldcx/agent'); or via ES6 modules import Agent from '@meldcx/agent';

Example Usage

import Agent from '@meldcx/agent';

const agent = new Agent();

const init = async() => {
    // Wait for the agent to be ready
    await agent.onReadyAsync();

    // You can now use any of the Agent library functions

    ...
};

init();

Debugging

Click here for a tutorial on how to debug your applications running on MeldCX AgentM.

Support

If you require any additional support or have any feature requests please email our helpdesk help@meldcx.com