So I've been working on a way to build GTK applications in JS, using JSX to define the UI layout. After an awful lot of hackery, monkeypatching both Preact and JSDOM to get it to render to a non-browser target, and dealing with the main thread problem that seems to be the reason there's no usable UI toolkit libraries for Node.js, I'm getting pretty close to a working implementation!
I am considering ripping out JSDOM entirely and writing my own 'fake DOM' implementation, though - it'd reduce monkeypatching by a lot, and Preact only really uses a tiny part of the DOM API anyway, and that's the only part I need to support. It'd also remove some annoying HTML-specific behaviours.
I might even fork Preact at some point since it also has some HTML-speciic bits, but that'd be a more impactful decision to make in terms of maintenance, so maybe not.
But, for now: I have a working setup where I can render some JSX to a 'virtual render target' provided by my implementation, and have the UI thread receive batches of changes to translate to GTK APIs!
#GTKJSX #FOSS #project