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

@glue42/electron

Package Overview
Dependencies
Maintainers
8
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glue42/electron

Glue42 Electron library

  • 0.1.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
31
increased by3000%
Maintainers
8
Weekly downloads
 
Created
Source

This package allows you to Glue42 enable your Electron application.

Basic Usage

  1. Install the package
npm i @glue42/electron
  1. Initialize the package in the main process of your Electron app, after Electron's app ready event.
import * as glue42Electron from '@glue42/electron';

...

const config = {
    appDefinition: {
        name: 'desktop-electron-app',
        title: 'Desktop Electron App'
    }
}
const glue = await glue42Electron.initialize(config);
  1. When your Electron window is ready, register it with Glue42
const gdMainWindow = glue.registerStartupWindow(this.mainWindow, {allowChannels: true, channelId: "Red"});

When you do this and you run yor app, the package will:

  • discover any running Glue42 instance, and connect to it
  • inject glue42 API into any window of your app
  • your main Window will become sticky and now you can stick it to any Glue42 windows

Advanced

Inject FDC3

By default the lib will inject Glue42 API into any window - if you want to change this and inject FDC3 you need to set inject option to "fdc3" when initializing the lib

const glue = await glue42Electron.initialize({ inject: "fdc3" });

Starting option - when the application is started from Glue42 Application Manager

const options = glue.startupOptions;
const context = options.context
const windowOptions = options.windowOptions;

You can also disable any injection by setting the option to none.

Application Factories

You can register your app as factory for certain window types, e.g. if you have a Chat Window in your app, you might want to allow other apps to create this window with a given context. To do so you can register an appFactory

 glue.registerAppFactory(
    {
      name: "child-app-electron",
      title: "Glue42 Electron Child Application"
    }, function(appDefinition, context, glue42electron) {
      // if you want some window options to override - you can use this
      // this.title = "my special title"
      // the first parameter is the app definition
      // the second one is the context - when restoring, starting with context
      // the third one is the service object which should be inject in the renderer, when preload: false
      // should return the newly created BrowserWindow
      const bw = new BrowserWindow();
      return bw;
    })

Registering a Child Window

const bw = new BrowserWindow();
 const glueWindow = glue.registerChildWindow(bw, {
        name: "child-app-electron-2",
        title: "Glue42 Electron Child Application"
      }, {
          mode: "tab",
          left: 100,
          top: 100,
          width: 400,
          height: 400
        }
      })

Keywords

FAQs

Package last updated on 17 Jan 2023

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