Agent

AgentAgent~ Agent

The Agent library communicates with the AgentM application to provide powerful and extended functionality inside of the Webview

Methods

(async) onReady(callback) → {Undefined}

Register a callback to invoked when the Agent is ready

Parameters:
Name Type Description
callback function

The function to call when the Agent is ready

Throws:
Example

Example callback usage

import Agent from '@meldcx/agent'
// or
const Agent = require('@meldcx/agent');

const agent = new Agent();

agent.onReady(() => console.log('The Agent is ready'));

(async) onReadyAsync() → {Promise.<Agent>}

Wait for the agent to be ready using a Promise, this enables the onReady function to be used with async/await

Throws:
Example
import Agent from '@meldcx/agent'
// or
const Agent = require('@meldcx/agent');

const agent = new Agent();

agent.onReadyAsync().then(() => console.log('The Agent is ready'));