Glue
5.21.0Glue42 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.
APIobject
Description
Instance of the initialized Glue42 library.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
agm | API | Interop library. |
||
appManager | API | Application Management library. |
||
bus | API | Pub/Sub library. |
||
channels | API | Channels library. |
||
connection | API | Connection library. |
||
contexts | API | Contexts library. |
||
cookies | API | Cookies API Available since version Glue42 3.16 |
||
displays | API | Displays library. Available since version Glue42 3.9 |
||
hotkeys | API | Hotkeys library. |
||
info | object | Info object containing versions of all included libraries and Glue42 itself. |
||
intents | API | Intents API Available since version Glue42 3.9 |
||
interop | API | Interop library. |
||
layouts | API | Layouts library. |
||
logger | API | |||
metrics | API | Metrics library. |
||
notifications | API | Notifications API (alpha version) Available since version Glue42 3.9 |
||
prefs | API | Preferences API Available since version Glue42 3.12 |
||
themes | API | Themes API Available since version Glue42 3.10 |
||
version | string | Glue42 version. |
||
windows | API | Window Management library. |
||
workspaces | API | Workspaces library Available since version Glue42 3.10 |
Methods
donemethod
Signature
() => Promise<void>
Description
Disposes Glue42 API. This will remove all Interop methods and streams registered by the application.
feedbackmethod
Signature
(info?: FeedbackInfo) => void
Description
Brings up the Glue42 Desktop feedback dialog.
Parameters
Name | Type | Required | Description |
---|---|---|---|
info | FeedbackInfo |
Authobject
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 theglue.connection.authToken()
method;sspi
- usingsessionId
and authentication challenge callback;
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
flowCallback | (sessionId: string, token: any) => Promise<{ data: any; }> | |||
flowName | "sspi" | |||
gatewayToken | string | Authenticate using gatewayToken |
||
password | string | Password to be used |
||
provider | string | GW auth provider to be used |
||
providerContext | any | A context object, which will be passed along to the GW auth provider to be used to request verification |
||
sessionId | string | |||
token | string | Authenticate using token generated from the auth provider. |
||
username | string | Username to be used |
Configobject
Description
Optional configuration object when initializing the Glue42 library.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
application | string | Application name. If not specified, the value depends on the hosting environment.
For the browser - |
||
appManager | boolean | "startOnly" | "skipIcons" | "full" | false | Whether to initialize the Application Manager or not. |
|
auth | string | Auth | Authentication can use one of the following flows:
|
||
bus | boolean | Enable or disable the Pub/Sub API. |
||
channels | boolean | false | Whether to initialize the Channels API or not. |
|
contexts | boolean | ContextsConfig | Enable, disable and configure the Contexts API. |
||
customLogger | CustomLogger | Pass this to override the build-in logger and handle logging on your own |
||
displays | boolean | Whether to initialize the Displays library or not. |
||
exposeGlue | boolean | Configures whether Glue42 will share the initialized API object upon request via a custom web event. Defaults to true. |
||
gateway | GatewayConfig | Configurations for the Glue42 Gateway connection. |
||
identity | { [key: string]: string | number | boolean; } | Specify custom identity fields. Those can also override some of the system fields assigned |
||
intents | Config | Whether to use IntentsResolver UI for handling raised intents. |
||
layouts | boolean | "full" | "slim" | "fullWaitSnapshot" | Configuration | "slim" | Whether to initialize the Layouts API or not. |
|
libraries | ((glue: Glue, config?: Config) => Promise<void>)[] | A list of glue libraries which will be initiated internally and provide access to specific functionalities |
||
logger | "off" | "trace" | "debug" | "info" | "warn" | "error" | LoggerConfig | Defines logging levels per output target. |
||
metrics | boolean | MetricsConfig | Metrics configurations. |
||
windows | boolean | true | Whether to initialize the Window Management API or not. |
GatewayConfigobject
Description
Configurations for the Glue42 Gateway connection.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
gwTokenProvider | GwTokenProvider | A way to pass custom token provider for Gateway v.3 tokens. |
||
inproc | InprocGWSettings | Connect with GW in memory |
||
protocolVersion | number | Legacy (Version of the Gateway that you are connected to) |
||
reconnectAttempts | number | 10 | Number of reconnect attempts. |
|
reconnectInterval | number | 500 | Reconnect interval in milliseconds. |
|
sharedWorker | string | |||
webPlatform | WebPlatformConnection | An object containing the configuration settings when core is operating in a web platform environment |
||
ws | string | URL for the WebSocket connections to the Gateway. |
InprocGWSettingsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
facade | GW3Facade |
LoggerConfigobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
console | LogLevel | Console logging level. |
||
publish | LogLevel | File logging level. |
MetricsConfigobject
Description
Metrics configurations.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
disableAutoAppSystem | boolean | If |
||
pagePerformanceMetrics | PagePerformanceMetricsConfig |
PagePerformanceMetricsConfigobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
enabled | boolean | |||
initialPublishTimeout | number | |||
publishInterval | number |
Screenobject
Description
Object describing a screen.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
height | number | Screen height. |
||
isPrimary | boolean | Whether this is the primary screen. |
||
left | number | Horizontal coordinate of the top left corner of the screen. |
||
name | string | Name of the screen assigned by the operating system. |
||
scale | number | Screen scale factor. |
||
scaleX | number | Scale factor of the horizontal axis of the screen. |
||
scaleY | number | Scale factor of the vertical axis of the screen. |
||
top | number | Vertical coordinate of the top left corner of the screen. |
||
width | number | Screen width. |
||
workingAreaHeight | number | Height of the working area. |
||
workingAreaLeft | number | Horizontal coordinate of the top left corner of the screen working area. |
||
workingAreaTop | number | Vertical coordinate of the top left corner of the screen working area. |
||
workingAreaWidth | number | Width of the working area. |
WebPlatformConnectionobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
port | MessagePort | |||
windowId | string |