Gluon v0.9

CanadaHonk · January 3, 2023

Happy new year! Here’s a new Gluon release to start it off. Gluon v0.9.0 is out with 2 new APIs, Idle v2, initial macOS support, and more!

Summary

  • New Window.versions API with browser version info
  • New Window.controls API to manage window state (minimize/maximize/etc)
  • New additions and improvements to Window.idle:
    • Window.idle.sleep() now performs a light version of hibernation
    • Now uses CDP commands instead of native to detect processes
  • Added new useSessionId option to Window.cdp.send(), allowing to send browser-level CDP commands instead of just to target
  • Added initial Mac support

Browser Version Info New API

There’s a new Window.versions API to provide you with version info of the browser being used. Here are some examples of what you can expect:

// Chrome
{
  product: { name: 'Chrome', version: '107.0.5304.107', major: 107 },
  engine: { name: 'chromium', version: '107.0.5304.107', major: 107 },
  jsEngine: { name: 'v8', version: '10.7.193.22', major: 10 }
}

// Firefox Nightly
{
  product: { name: 'Firefox Nightly', version: '110.0a1', major: 110 },
  engine: { name: 'firefox', version: '110.0a1', major: 110 },
  jsEngine: { name: 'spidermonkey', version: '1.8.5', major: 1 }
}

Window Controls New API

The new Window.controls allows you to easily manage the state of the browser window with the functions:

  • minimize() - Minimize the browser window.
  • maximize() - Maximize the browser window (use show() first if you want to make it appear too).
  • show() - Show (unminimize) the browser window.

Idle v2 Improved API

Gluon’s unique Idle API has received a second iteration with this update:

  • Hibernation is more robust - internals have been rewritten to more stable by talking to Chromium to get processes instead of using native commands.
  • Sleep introduced - a lighter version of hibernation, using a screenshot of the page instead of completely killing it. Sleep also works cross-platform (hibernation is Windows-only for now).

CDP Tweaks Improved API

The CDP (Chrome DevTools Protocol) API has gotten a minor improvement by now being able to send direct browser commands with a new useSessionId argument added to cdp.send():

send(method: string, params?: Object, useSessionId?: Boolean = true)

You should keep it enabled most of the time, but if you need to send a direct command yourself you can make it false.


Initial macOS Support

This update also brings new macOS support! Only a few browsers are added for now so it’s still a work in progress, but they work pretty well.