Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xolabot-sdk

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xolabot-sdk

XolaBot SDK

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Xolabot SDK

Installation

$ npm install xolabot-sdk xolabot-scripts

Create entry point file: src/index.js.

Setup scripts in your package.json.

{
    "scripts": {
        "start": "xolabot-scripts start",
        "build": "xolabot-scripts build"
    }
}

Start Development Server

$ npm start

This will spin up a development server and serve your module from: http://localhost:3000/main.js.

You can use that address to register a plugin in App Store server.

Usage

In src/index.js:

import Module from 'xolabot-sdk';

class MyModule extends Module {
    constructor(...args) {
        super('my_module_name', ...args);

        // Register bus event listeners here...
    }
}

// Required.
// This is how module will be registered with Xolabot.
MyModule.load();

Available APIs

Event Bus (EventBus)

Event bus is available as an instance property: this.bus.

Subscribe to an event.
/**
 * @param   {Object}   event
 * @param   {string}   event.channel
 * @param   {string}   event.type
 * @param   {Function} listener
 * @returns {Function} Function for unsubscribing from the event.
*/
this.bus.on(event, listener);
Subscribe to an event once.
/**
 * @param   {Object}   event
 * @param   {string}   event.channel
 * @param   {string}   event.type
 * @param   {Function} listener
 * @returns {Function} Function for unsubscribing from the event.
*/
this.bus.once(event, listener);
Unsubscribe from an event.
/**
 * @param   {Object}   event
 * @param   {string}   event.channel
 * @param   {string}   event.type
 * @param   {Function} listener
 * @returns {Function} Function for unsubscribing from the event.
*/
this.bus.off(event, listener);

API Client (Axios)

Available as an instance property: this.api.

See official documentation.

this.api {Axios}

Save State to Local Storage

/**
 * @param state {Object}
 */
this.saveState(state);

FAQs

Package last updated on 12 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc