Gluon v0.12

CanadaHonk · January 28, 2023

Gluon v0.12.0 is out with super-fast startups, cross-platform Idle, new APIs, and more!


Super-fast Startup Times

Gluon’s startup time (time it takes to open and load a browser window) is now halved compared to the last release, making it one of the fastest frameworks out there.

Gluon 0.12 ✨
0.4s
Electron
0.5s
Tauri
0.9s
Gluon 0.11
1s
Neutralinojs
1.2s

Data from Gluon using Node + Chromium, all frameworks in release config, measured on my machine (Ryzen 5600H) with latest Windows 10.


Idle
Improved API

The Idle API now supports Linux and Mac too, including full hibernation!

Idle Freezing New API

Gluon’s Idle API now provides a function to let you “freeze”/“pause” the page, stopping most execution and saving resources lightly. This a lighter approach than the existing functions which also retains the page state instead of resetting it as if the page had reloaded.

node.js
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://gluonjs.org');

const wait = ms => new Promise(resolve => setTimeout(resolve, ms));

Window.idle.freeze(); // Freeze the window
await wait(5000); // Wait a while
Window.idle.wake(); // Unfreeze!

Page Improved API

Reload New API

You can now reload the page with a new function just for it, also with an option to ignore the cache that reload as well.

node.js
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://gluonjs.org');

await Window.page.reload(); // Reload the page

await Window.page.reload(true); // Reload the page, also ignoring cache for it

Title Overhauled API

The page title API has completely changed, now using a function to simplify things.

node.js
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://gluonjs.org');

const currentTitle = await Window.page.title(); // Get the current title
await Window.page.title('new title'); // Set a new title

V8 Cache
New API

There’s a new experimental V8 Cache API for interfacing with V8’s compilation cache. This allows for potentially improved load times, especially for larger apps. The docs go further in-depth if you are interested.

node.js
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://gluonjs.org');

// Default V8 Cache is automatically loaded if it was previously built

// Build a V8 Cache (with default options)
await Window.v8Cache.build();

Controls Improved API

Show Improved API

You can now set the window bounds (position and/or size) with the show function.

node.js
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://gluonjs.org');

await Window.controls.show({
  left: 100, // 100px, 100px window position
  top: 100,
  width: 600, // 600x800px window size
  height: 800
});

Local File Support Improved API

The correct Content-Type header is now sent with local files, fixing a few issues with some setups.


CDP Improved API

Event Listening New API

The CDP API now gives you the ability to listen to CDP events with the new on function, returning a function to unhook the callback given.

node.js
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://gluonjs.org');

const unhook = Window.cdp.on('Runtime.exceptionThrown', ({ params: { exceptionDetails } }) => {
  console.log('an exception was thrown in web:', exceptionDetails);
});

// ...

unhook();

New Docs

The Gluon docs have been overhauled alongside versioning support, and all pages are now filled out. If you have any feedback on them please report it!


Hope you have fun with the new release! Let me know your feedback and opinions in the Discord.