For updated documentation, please see the GJS repository.
1. Objects
1.0.1. 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 });
1.0.2. Signals
Every gjs object has a "connect" method. Example:
actor.connect('button-press-event', function (actor, event) { ... });
1.0.3. GProperties
GObject properties may be retrieved and set using JavaScript property style access. Example:
box.y_align = Big.BoxAlignment.CENTER:
2. Enumerations and Flags
Both enumerations and flags appear as entries under the namespace, with associated member properties. Example:
Gtk.WindowType.TOPLEVEL;
3. Structures
C structures have JavaScript properties for each member. Generally you should treat these as read-only.
4. Unions
Unions are currently opaque.
5. Multiple return values
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);