npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

comm100-app-client

v1.0.3

Published

App Client SDK

Downloads

3

Readme

How to use comm100-app-client

The JavaScript SDK must be fully loaded, then you can call the JavaScript APIs.

Installation

npm

npm add comm100-app-client

yarn

yarn add comm100-app-client

Examples

We have several examples on the github. Here is the first one to get you started.

import { APPClient } from "comm100-app-client";

const Example = () => {
  const handleClick = async () => {
    const client = APPClient.init();
    const agent = await client.get("agentconsole.currentAgent");
  };

  return (
    <>
      <button onClick={handleClick}>Get Agent</button>
    </>
  );
};

What APIs We Provide

We provide 6 fundamental APIs to help you interact with the Comm100 Agent Console.

  1. GET

To get necessary information, you can use client.get:

/**
 * @param {string} name - Name of data
 * @param {...any} args - Any specific argument required
 * @return {Promise<any>} result
 */
const client = APPClient.init();
client.get(name, ...args).then(function (data) {});
  1. SET

To set information, you can use client.set:

/**
 * @param {string} name - Name of data
 * @param {any} value - Value
 * @param {...any} args - Any specific data needs to be set
 */
const client = APPClient.init();
client.set(name, value, ...args);
  1. ON

To register event callback function, please use client.on:

/**
 * @param {string} type - Name of event
 * @param {function} callback - Callback function. Params will be provided accordingly. Callback
 * will be triggered after event, which means callback cannot prevent default behavior of event
 * from happening.
 */
const client = APPClient.init();
client.on(name, function () {});
  1. OFF

Remove event callback function registered by the ON API.

/**
 * @param {string} type - Name of event
 * @param {function} callback - Callback function.
 */
const client = APPClient.init();
client.on(name, function () {});
  1. DO

To execute the action of the Agent, please use client.do:

/**
 * @param {string} name - Name of action
 * @param {...any} args - Any args required
 * @return {Promise<any>} Return promise to indicate if action is done successfully
 */
const client = APPClient.init();
client.do(name, args);
  1. REQUEST

When sending a backend request, if you don't provide the credentials for authorization, it brings current credentials.

/**
 * @param {string} url - The request address
 * @param {object} config - optional The configuration of web request, the configuration is the same with AXIOS, view this link https://axios-http.com/docs/req_config
 * @return {Promise<any>} Return request data
 */
const client = APPClient.init();
client.request(url, config);