Subclassing a GObject in Typescript



Is it possible to write a class in Typescript that derives from a GObject class and overrides its virtual native methods? GTK3 encourages subclassing instead of the old GTK2 way of using has-a relationships and connecting signals, but all the Typescript examples I can find use the old way.

The only other thing I've got to go on is the gjs wiki which has an example of using GObject.registerClass(), but that seems to be something added to GObject by gjs; I can't find an equivalent in GObject's C API and it isn't available in the GObject.d.ts generated by ts-for-gjs.

My inference is that if this registerClass() thing still exists in gjs and is described in the wiki, then it must be a necessary step, and if I just try to extend a G class in Typescript (or plain _javascript_) I won't be able to do things like override native methods.

--
TH



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]