If current object info is not exposed by GI repository data, we were unable to get object properties unless if they were exposed by the interfaces implemented by the GType.
However, we could still be able to access to properties and in particular vfunc's and methods by looking at the first valid parent gtype infos.
An example are the GSettings backends, in fact gir only exposes public classes but it's not possible to define or override virtual functions because such methods are not found in the type.
const { Gio, GLib, GObject } = imports.gi;
const backend = Gio.SettingsBackend.get_default();
print(backend.vfunc_read)
const MyBackend = GObject.registerClass(
class MyBackend extends backend.constructor {
vfunc_read(...args) {
print('read');
return super.vfunc_read(...args);
}
});
const myBackend = new MyBackend();
print(myBackend.vfunc_read)
print(myBackend.vfunc_read("foo", new GLib.VariantType('s'), false))
myBackend.writable_changed('/bar');
Before of this was failing with:
(gjs:1944332): Gjs-CRITICAL **: 04:28:13.527: JS ERROR: Error: Virtual function not implemented: Class GSettingsBackend doesn't implement read
@./test.js:4:1