giD v0.9.13 - Javascriptcore class templates, Android support, and more
Element Green
element at kymorphia.com
Wed Jun 10 18:58:34 UTC 2026
Thought I'd post an update on
[giD](https://code.dlang.org/packages/gid) (the GObject
Introspection binding repo for D) since the last announcement
made here (v0.9.6) because of some interesting developments.
In addition to many bug fixes and improvements, some notable new
features are:
Powerful class registration templates were added to the
Javascriptcore giD binding. Essentially this makes it easy to
register a D class with the high performance JIT Webkit
Javascript engine to call D code from Javascript for embedding JS
in D applications or writing D Javascript plugins. Either all
public methods and properties of a class can be registered
automatically or UDAs can be used to mark the desired API to
expose (see example below).
After some improvements to the giD dynamic library loader,
Android is now a supported platform, paving the way for cross
platform Gtk4/Adwaita development (Linux, Mac, Windows, and now
Android).
The awesome [dejadoc](https://codeberg.org/ddn/dejadoc) is now
being used to generate API documentation. This makes it easy to
have both Gtk3 and Gtk4 docs hosted in the same API reference and
looks [amazing](https://www.kymorphia.com/gid/) too!
Fluent builders were added to all giD bindings, which importantly
makes it possible to set construct-only properties (such as Gtk4
`cssName`). Some users also find this convenient for chaining
property assignments in a single call when constructing objects.
**Example:**
```D
auto window = Window.builder.modal(true).title("A modal
window").build;
```
**giD Javascriptcore example:**
```D
class MyDClass
{
this(double v)
{
val = v;
}
@property double aProperty() { return val; }
void aMethod(double someValue)
{
writeln("The method argument is: ", someValue);
}
private:
double val;
}
...
context.registerClass!(MyDClass, RegisterClassMode.Full);
auto jsCode = `
let obj = new MyDClass(42.0);
obj.aMethod(obj.aProperty);
`;
context.evaluate(jsCode);
...
```
More information about the Digitalmars-d-announce
mailing list