Re: Subclassing a GObject in Typescript
- From: makepost firemail cc
- To: Tony Houghton <h realh co uk>
- Cc: javascript-list gnome org
- Subject: Re: Subclassing a GObject in Typescript
- Date: Tue, 13 Nov 2018 18:01:54 +0200
Please consider sending a pull request to ts-for-gjs with definitions
and tests for registerClass, if you have time before I can write them.
It's a relatively new thing, haven't needed it yet. So far the focus has
been on GObject introspection. Definitions for other built-ins, such as
package, signals and system, would be helpful too.
Wouldn't say that has-a relationships and signals are an old way, just
one of the ways and quite useful at that.
On 2018-11-13 15:51, Tony Houghton wrote:
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
_______________________________________________
javascript-list mailing list
javascript-list gnome org
https://mail.gnome.org/mailman/listinfo/javascript-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]