Hadouken Node Adapter
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Add removeEventListener() Oct 24, 2016
html working Aug 23, 2018
jsdoc-template @ b02ca53 RUN-4827 - mostly there to parity with v1 (#207) Dec 10, 2018
repl RUN-3680 multi runtime port discovery tests Jan 16, 2018
resources/win RUN-3433 Fix for postinstall script and binary file (#43) Oct 13, 2017
src RUN-4827 - mostly there to parity with v1 (#207) Dec 10, 2018
test RUN-4730 listener callback not implemented in launchExternalProcess (#… Nov 29, 2018
tutorials RUN-4827 - mostly there to parity with v1 (#207) Dec 10, 2018
.editorconfig Run 3239 multi runtime window test (#26) Sep 5, 2017
.gitattributes RUN-3433 Fix for postinstall script and binary file (#43) Oct 13, 2017
.gitignore RUN-4299 Add js-adapter testing with core (#152) Aug 8, 2018
.gitmodules Switch to SSH for submodules (#209) Dec 6, 2018
.npmignore Feature/36 alpha (#190) Sep 27, 2018
.travis.yml added the .travis.yml file for testing build and lint erros for PR's … Oct 23, 2017
Gruntfile.js RUN-4758 build fix (#208) Dec 10, 2018
LICENSE Fix license (#95) Mar 14, 2018
README.md Core builds should be optional. (#171) Aug 23, 2018
coreUtils.js RUN-4299 Add js-adapter testing with core (#152) Aug 8, 2018
docs.README(OLD).md RUN-4827 - mostly there to parity with v1 (#207) Dec 10, 2018
docs.README.md RUN-4827 - mostly there to parity with v1 (#207) Dec 10, 2018
jsdoc-conf.json RUN-4827 - mostly there to parity with v1 (#207) Dec 10, 2018
package-lock.json RUN-4758 build fix (#208) Dec 10, 2018
package.json RUN-4758 build fix (#208) Dec 10, 2018
tsconfig.json RUN-4299 Add js-adapter testing with core (#152) Aug 8, 2018
tslint.json Now using the HadoukenIO Core lint rules. (#52) May 11, 2017

README.md

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"

Test with core

npm test -- --ver=alpha --build-core --core=~/core

or without specifying the core path (core will be cloned from GH into core directory):

npm test -- --ver=alpha --build-core

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