How to...

Referencing

The Glue42 JavaScript library is available as a single JavaScript file, which you can include in your apps. If you are using a Glue42 installer, you can find the JavaScript files in %LOCALAPPDATA%\Tick42\GlueSDK\GlueJS\js. When deploying your app in production, it is recommended to always reference a specific minified version:

import Glue from "../scripts/desktop.umd.min.js";

The Glue42 JavaScript library is also available as an NPM package, which you can include as a dependency in your project and import in your code. The currently available packages are @glue42/core and @glue42/desktop. The Core package is a subset of the Desktop package and offers basic functionalities for sharing data between apps (Interop, Shared Contexts, Pub/Sub, Metrics), while the Desktop package offers additional options for sharing data between apps (Channels), as well as advanced window management functionalities (App Management, Layouts, Window Management).

To include any of the packages as a dependency in your project, navigate to the root directory of your project and run:

npm install @glue42/desktop

To reference the Glue42 library:

import Glue from "@glue42/desktop";

Initialization

If your Node.js app is started by Glue42 Enterprise, you can initialize the Glue42 library without passing a configuration object to the factory function:

import Glue from "@glue42/desktop";

// No configuration object.
const glue = await Glue().catch(console.error);

console.log(glue.version);

App Configuration

To add your Node.js app to the Glue42 Toolbar, you must create a JSON file with app configuration. Place this file in the %LocalAppData%\Tick42\UserData\<ENV-REG>\apps folder, where <ENV-REG> must be replaced with the environment and region of your Glue42 Enterprise copy (e.g., T42-DEMO).

The following is an example configuration for a Node.js app:

{
    "name": "node-server",
    "type": "node",
    "service": true,
    "details": {
        "path": "%GDDIR%/PathToMyServer/index.js",
        "showConsole": true
    }
}

The "name", "type" and "path" properties are required and "type" must be set to "node". The "path" property points to a JavaScript file that Glue42 Enterprise will execute in a Node.js environment.

For details on how to configure a remotely hosted Node.js app, see the Developers > Configuration > Application section.

For details on how to use different Node.js versions, see the Using Different Node.js Versions section.

Glue42 JavaScript Concepts

Once the Glue42 JavaScript library has been initialized, your app has access to all Glue42 functionalities. For more detailed information on the different Glue42 concepts and APIs, see:

Reference

For a complete list of the available JavaScript APIs, see the Glue42 JavaScript Reference Documentation.