npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@glue42/electron

v0.1.6

Published

Glue42 Electron library

Downloads

8

Readme

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
        }
      })