Glue

5.6.5

Glue42 Enterprise is a real-time user interface (UI) integration platform. Applications are combined at the user interface level to provide a better user experience (UX). UI integration makes it easier for users to access the right data and functionality at the right time and also reduce the number of times they need to copy/paste their way between one application and another. Glue42 Enterprise provides intuitive paths from one function to the next, in order to deliver business outcomes quickly and reliably. It allows developers to connect to any (legacy, 3rd party or modern) web or desktop application and have multiple apps interact with each other in real time.

The Glue42 JavaScript library enables JavaScript applications to participate in Glue42 Enterprise and use Glue42 functionalities via a set of APIs.

Referencing the Library

From a JavaScript File

Glue42 JavaScript is a library available as a single JavaScript file, which you can include in your web applications using a <script> tag. If you are using a Glue42 installer, you can find the JavaScript files in %LOCALAPPDATA%\Tick42\GlueSDK\GlueJS\js\web.

<script type="text/javascript" src="desktop.umd.js"></script>

When deploying your application in production, it is recommended to always reference a specific minified version:

<script type="text/javascript" src="desktop.umd.min.js"></script>

Using the Glue42 CDN

You can alternatively point to Glue42 JavaScript npm packages and files via the Glue42 CDN by using URLs in the format:

https://cdn.glue42.com/:package@:version/:file
  • Using the latest version: https://cdn.glue42.com/desktop@latest;
  • Using a fixed version: https://cdn.glue42.com/desktop@5.6.1
  • Using a specific file different from the one defined in the package.json: https://cdn.glue42.com/browse/desktop@5.6.1/dist/web/@glue42/desktop.min.js
  • To see all available versions and files, append / to the URL: https://cdn.glue42.com/desktop/

From an NPM Module

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 applications (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

Your package.json file now should have an entry similar to this:

{
  "dependencies": {
    "@glue42/desktop": "^5.6.1"
  }
}

Initializing the Library

When included, the JavaScript library will register a global factory function called Glue(). It should be invoked with an optional configuration object to initialize the library. The factory function will resolve with the initialized glue API object.

Initialization in a Glue42 window:

import Glue from "@glue42/desktop";

// You don't need to specify any configuration.
const initializeGlue42 = async () => {
  window.glue = await Glue();
};

initializeGlue42().catch(console.error);

See also the Glue42 Enterprise documentation for more details.

object

Description

Optional configuration object when initializing the Glue42 library.

Properties

boolean | "startOnly" | "skipIcons" | "full"

Whether to initialize the Application Manager or not.

Default: false

boolean | "full" | "slim" | "fullWaitSnapshot"

Whether to initialize the Layouts API or not.

Default: "slim"

boolean | "trackMyOnly" | "trackMyTypeAndInitiatedFromMe" | "trackAll" | "trackTypes"

Whether to initialize the Activities API or not.

Default: "trackMyTypeAndInitiatedFromMe"

boolean

Whether to initialize the Window Management API or not.

Default: true

boolean

Whether to initialize the Channels API or not.

Default: false

boolean

Whether to initialize the Displays library or not.

((glue: Glue, config?: Config) => Promise<void>)[]

A list of glue libraries which will be initiated internally and provide access to specific functionalities

string

Application name. If not specified, the value depends on the hosting environment. For the browser - document.title + random number (e.g., ClientList321333). In Glue42 - containerName + browserWindowName (e.g., Internal.ClientList).

Configurations for the Glue42 Gateway connection.

boolean | MetricsConfig

Metrics configurations.

boolean

Enable or disable the Contexts API.

boolean

Enable or disable the Pub/Sub API.

"off" | "trace" | "debug" | "info" | "warn" | "error" | LoggerConfig

Defines logging levels per output target.

Pass this to override the build-in logger and handle logging on your own

string | Auth

Authentication can use one of the following flows:

  • username/password;
  • token - access tokens can be generated after successful login from the Auth Provider (e.g., Auth0);
  • gatewayToken - Gateway tokens are time limited tokens generated by the Gateway after an explicit request. To generate one, use the glue.connection.authToken() method;
  • sspi - using sessionId and authentication challenge callback;

object

Description

Instance of the initialized Glue42 library.

methoddone
() => Promise<void>

Description

Disposes Glue42 API. This will remove all Interop methods and streams registered by the application.

Returns

Promise<void>

Properties

Window Management library.

Activities library.

Application Management library.

Layouts library.

Channels library.

Hotkeys library.

Displays library.

Available since version Glue42 3.9

Intents API

Available since version Glue42 3.9

Notifications API (alpha version)

Available since version Glue42 3.9

Workspaces library

Available since version Glue42 3.10

Themes API

Available since version Glue42 3.10

Preferences API

Available since version Glue42 3.12

Connection library.

Interop library.

Interop library.

Pub/Sub library.

Metrics library.

Contexts library.

(info?: FeedbackInfo) => void

Brings up the Glue42 Desktop feedback dialog.

object

Info object containing versions of all included libraries and Glue42 itself.

string

Glue42 version.

object

Description

Object describing a screen.

Properties

number

Screen height.

boolean

Whether this is the primary screen.

number

Horizontal coordinate of the top left corner of the screen.

string

Name of the screen assigned by the operating system.

number

Screen scale factor.

number

Scale factor of the horizontal axis of the screen.

number

Scale factor of the vertical axis of the screen.

number

Vertical coordinate of the top left corner of the screen.

number

Screen width.

number

Height of the working area.

number

Horizontal coordinate of the top left corner of the screen working area.

number

Vertical coordinate of the top left corner of the screen working area.

number

Width of the working area.

object

Description

Authentication can use one of the following flows:

  • username/password;
  • token - access tokens can be generated after successful login from the Auth Provider (e.g., Auth0);
  • gatewayToken - Gateway tokens are time limited tokens generated by the Gateway after an explicit request. To generate one, use the glue.connection.authToken() method;
  • sspi - using sessionId and authentication challenge callback;

Properties

string

Username to be used

string

Password to be used

"sspi"

(sessionId: string, token: any) => Promise<{ data: any; }>

string

string

Authenticate using token generated from the auth provider.

string

Authenticate using gatewayToken

object

Description

Configurations for the Glue42 Gateway connection.

Properties

string

URL for the WebSocket connections to the Gateway.

number

Legacy (Version of the Gateway that you are connected to)

number

Reconnect interval in milliseconds.

Default: 500

number

Number of reconnect attempts.

Default: 10

A way to pass custom token provider for Gateway v.3 tokens.

string

An object containing the configuration settings when core is operating in a web platform environment

Connect with GW in memory

object

Description

Metrics configurations.

Properties

boolean

If false (default), an App system will be created on top level, and all other metrics will live in it. If true, an App system will be created, and all metrics will live on top level.

object

Properties

object

Properties

Console logging level.

File logging level.

function

methodGlue
(config: Config) => Promise<Glue>

Description

Factory function that creates a new Glue42 instance.

Parameters

Name
Type
Required
Description

config

no

Returns

Promise<Glue>