Gluon
Develop desktop apps from websites, using system installed browsers and NodeJS.
Quick Start GitHub DiscordDevelop desktop apps from websites, using system installed browsers and NodeJS.
Quick Start GitHub DiscordGluon uses normal already installed browsers, instead of bundling a browser or relying on webview libraries.
Unlike others, Gluon supports Chromium and Firefox, allowing user and developer choice.
Gluon has simple yet powerful APIs and avoids boilerplate, allowing fast prototyping.
Gluon is young and quickly evolving, actively listening to feedback.
Gluon also supports using Deno in place of NodeJS as an option.
Opening a Window in Gluon is as simple as one function call, with more options available if you need them like window size or loading extra code.
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('');
IPC (Inter-Process Communication) allows you to communicate between your Node backend and website frontend.
Gluon has an easy but powerful asynchronous IPC API, which is also near-identical in Node and the exposed Gluon web API to allow even easier and quicker development.
It also has multiple versatile sub-APIs for doing common things, wrapping the base API so most developers won’t need to use a needlessly complex event-based system:
Easily expose Node functions to Web.
Share common data effortlessly between Node and Web both ways.
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('');
Window.ipc.store.config = {
env: 'production'
};
import { writeFile } from 'fs/promises';
let log = '';
Window.ipc.log = msg => { // Log data to a log file on disk
log += msg;
writeFile('app.log', log); // Write to log file
};
// In your website's JS
// Get data from IPC Store
const { env } = await Gluon.ipc.store.config;
env // 'production'
// Call exposed IPC function
Gluon.ipc.log('Stored to log file!');
The Idle API is a unique feature to Gluon, allowing you to “hibernate” or “sleep” Gluon windows to save system resources.
Hibernation fully kills the browser internally (using ~30MB of memory), whilst sleep uses a screenshot of the page as a placeholder (using ~60MB of memory).
You can either hibernate, sleep, and wake up manually with the API, or use automatic idle management which will hibernate the window when minimized for a chosen period of time, and wake it up when it’s focused again for you.
// In your Node backend
import * as Gluon from '@gluon-framework/gluon';
const Window = await Gluon.open('https://example.com');
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
await sleep(5000); // Wait for the window to fully load
Window.idle.hibernate(); // Hibernate the window
await sleep(5000);
Window.idle.wake(); // Wake up the window
await sleep(5000);
Window.idle.sleep(); // Put the window to sleep
await sleep(5000);
Window.idle.wake(); // Wake it up again