|
|
## Objects
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
Object constructors look like JavaScript constructors, and can take a map of properties. Example:
|
|
|
|
|
|
let actor = new Clutter.Group({ reactive: true, width: 100, height: 100 });
|
|
|
|
|
|
### Signals
|
|
|
|
|
|
Every gjs object has a "connect" method. Example:
|
|
|
|
|
|
actor.connect('button-press-event', function (actor, event) {
|
|
|
...
|
|
|
});
|
|
|
|
|
|
### GProperties
|
|
|
|
|
|
GObject properties may be retrieved and set using JavaScript property style access. Example:
|
|
|
|
|
|
box.y_align = Big.BoxAlignment.CENTER;
|
|
|
|
|
|
## Enumerations and Flags
|
|
|
|
|
|
Both enumerations and flags appear as entries under the namespace, with associated member properties. Example:
|
|
|
|
|
|
Gtk.WindowType.TOPLEVEL;
|
|
|
|
|
|
## Structures
|
|
|
|
|
|
C structures have JavaScript properties for each member. Generally you should treat these as read-only.
|
|
|
|
|
|
## Unions
|
|
|
|
|
|
Unions are currently opaque.
|
|
|
|
|
|
## Multiple return values (caller-allocates)
|
|
|
|
|
|
For functions which have multiple out parameters, the return values are gathered into an array. Example:
|
|
|
|
|
|
// Calling clutter_actor_get_size
|
|
|
let [x, y] = actor.get_size();
|
|
|
|
|
|
If the function has a return value, in addition to the out parameters, the return value will be the first element of such array. Example:
|
|
|
|
|
|
// Calling gtk_recent_info_get_application_info
|
|
|
let [success, appExec, count, time] = this._docInfo.get_application_info(appName); |
|
|
\ No newline at end of file |