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

hadouken-js-adapter

Package Overview
Dependencies
Maintainers
10
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hadouken-js-adapter

Allows the use of the Hadouken API from node.js.

  • 0.32.1-alpha.4
  • npm
  • Socket score

Version published
Weekly downloads
915
increased by39.27%
Maintainers
10
Weekly downloads
 
Created
Source

Hadouken Node.js adapter Build Status

Allows the use of the Hadouken API from node.js.

Requirements

  • Node.js LTS ^6.9

Install as dependency

$ npm install -S hadouken-js-adapter

Usage

Connecting to an already running runtime

const { connect, Identity } = require("hadouken-js-adapter");

async function launchApp() {
    const fin  = await connect({
        address: "ws://localhost:9696",
        uuid: "my-uuid-123"
    });

    const version = await fin.System.getVersion();
    console.log("Connected to Hadouken version", version);

    const app = await fin.Application.create({
	name: "adapter-test-app",
	url: 'http://hadouken.io/',
	uuid: "adapter-test-app",
	autoShow: true,
	nonPersistent : true
    });

    await app.run();
}

launchApp().then(() => {
    console.log("success");
}).catch((err) => {
    console.log("Error trying to connect,", err.message);
    console.log(err.stack);
});

Launching a runtime and connecting

const { connect, Identity } = require("hadouken-js-adapter");

async function launchApp() {
    const fin  = await connect({
        uuid: "my-uuid-123",
        runtime: {
            version: 'stable'
        }
    });

    const version = await fin.System.getVersion();
    console.log("Connected to Hadouken version", version);

    const app = await fin.Application.create({
        name: "adapter-test-app",
        url: 'http://hadouken.io/',
        uuid: "adapter-test-app",
        autoShow: true,
        nonPersistent : true
    });

    await app.run();
}

launchApp().then(() => {
    console.log("success");
}).catch((err) => {
    console.log("Error trying to connect,", err.message);
    console.log(err.stack);
});

Note that either an address or a runtime object with version are required to connect

Mac and Linux Environment settings

In order to configure system policies, the js adapter respects the following group policy settings when set as environment variables on Mac and Linux:

  • assetsUrl
  • runtimeArgs
  • runtimeDirectory

Local build

npm run build

Test

npm test -- --ver=alpha

Only executing tests that pattern match "Application"

npm test -- --ver=alpha --grep="Application"

Executing tests that do not pattern match "System"

npm test -- --ver=alpha --invert --grep="System"

Repl

To start the read-eval-print loop:

npm run repl -- --ver=alpha

Generated documentation

We use JSDoc for documentation and generating the documentation will require our custom JSDoc template. Use the following commands to execute the docs task:

git submodule init
git submodule update
npm run doc

FAQs

Package last updated on 08 Jun 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