... | ... | @@ -6,16 +6,22 @@ If you use it, especially for GNOME-related projects, please follow the [Style G |
|
|
|
|
|
## Documentation
|
|
|
|
|
|
### Gnome API
|
|
|
|
|
|
Documentation for Gnome APIs (GLib, GObject, Gtk, etc) is currently hosted at https://devdocs.baznga.org/.
|
|
|
|
|
|
There are also a growing number of usage examples in the GitLab repository under [examples/][gjs-examples] and thorough tests of language features in the [test suite][gjs-tests].
|
|
|
|
|
|
### JavaScript
|
|
|
|
|
|
GJS 1.50 is based on Mozilla's SpiderMonkey 52 and ES6 support (AKA ECMAScript 2015) is nearly complete, while still including support for "legacy" style GJS classes.
|
|
|
|
|
|
If you are curious when a language feature landed or targeting a range of GJS versions, review [NEWS](https://gitlab.gnome.org/GNOME/gjs/raw/master/NEWS) in the GitLab repository. In many cases you can support older versions of GJS using [polyfills](https://developer.mozilla.org/docs/Glossary/Polyfill) and legacy-style classes.
|
|
|
If you are curious when (or if) a language feature landed or targeting a range of GJS versions, review [NEWS][gjs-news] in the GitLab repository. In many cases you can support older versions of GJS using [polyfills][mdn-polyfills] and legacy-style classes.
|
|
|
|
|
|
[gjs-examples]: https://gitlab.gnome.org/GNOME/gjs/tree/master/examples
|
|
|
[gjs-news]: https://gitlab.gnome.org/GNOME/gjs/raw/master/NEWS
|
|
|
[gjs-tests]: https://gitlab.gnome.org/GNOME/gjs/blob/master/installed-tests/js
|
|
|
[mdn-polyfills]: https://developer.mozilla.org/docs/Glossary/Polyfill
|
|
|
|
|
|
### Mapping
|
|
|
|
... | ... | @@ -30,12 +36,38 @@ Please see the [Modules](Modules) page for an overview of the built-in modules a |
|
|
|
|
|
### Overrides
|
|
|
|
|
|
GJS also includes a few overrides for Gnome APIs, mostly for compatibility, but include a few convenience functions like `makeProxyWrapper()` and `wrapJSObject()` in the Gio overrride for easy DBus Client/Server building.
|
|
|
GJS has overrides for some Gnome APIs, mostly for compatibility, but also providing some useful utilities.
|
|
|
|
|
|
* [GLib](https://gitlab.gnome.org/GNOME/gjs/blob/master/modules/overrides/GLib.js): GVariant, GBytes compatibility.
|
|
|
|
|
|
* `GLib.log_structured()`: Wrapper for g_log_variant()
|
|
|
* `GLib.Bytes.toArray()`: Convert a GBytes object to a native Array
|
|
|
* `GLib.Variant.unpack()`: Unpack a variant to a native type
|
|
|
* `GLib.Variant.deep_unpack()`: Recursively unpack
|
|
|
* [GObject](https://gitlab.gnome.org/GNOME/gjs/blob/master/modules/overrides/GObject.js): Mostly GObject implementation (properties, signals, GType mapping). May be useful as a reference.
|
|
|
* [Gio](https://gitlab.gnome.org/GNOME/gjs/blob/master/modules/overrides/Gio.js): Includes numerous utilities for DBus that will documented further at a later date.
|
|
|
|
|
|
* `Gio.DBus.session, Gio.DBus.system`
|
|
|
|
|
|
Convenience properties that wrap Gio.bus_get_sync() to return DBus session/system connection
|
|
|
* `Gio.DBusInterfaceInfo.new_for_xml(xmlString)`: return a new Gio.DBusNodeInfo
|
|
|
* `Gio.DBusProxy.makeProxyWrapper(xmlString|Gio.DBusNodeInfo)`
|
|
|
|
|
|
* GLib: GVariant, GBytes compatibility.
|
|
|
* GObject: Mostly GType and GParamSpec, but a good reference for implementing GObject Properties
|
|
|
* Gio (DBus.[session,system], makeProxyWrapper(), wrapJSObject(), new_for_xml(), connect/disconnectSignal...)
|
|
|
* Gtk: Mostly GtkBuilder template implementation
|
|
|
Utility for creating DBus clients (See [here][old-dbus-example] for the original example).
|
|
|
|
|
|
Returns a `function(bus, name, object, asyncCallback, cancellable)` which can be called to return a new `Gio.DBusProxy` for the first interface node of `xmlString|Gio.DBusNodeInfo`.
|
|
|
* `Gio.DBusExportedObject.wrapJSObject(Gio.DbusInterfaceInfo, jsObj)`
|
|
|
|
|
|
Wrap the object instance `jsObj` which should implement the interface described by `Gio.DbusInterfaceInfo` and return an object with methods:
|
|
|
|
|
|
* `export(busConnection, objectPath)`
|
|
|
* `unexport()`
|
|
|
* `flush()`
|
|
|
* `emit_signal(name, variant)`
|
|
|
* `emit_property_changed(name, variant)`
|
|
|
* [Gtk](https://gitlab.gnome.org/GNOME/gjs/blob/master/modules/overrides/Gtk.js): Mostly composite template implementation. Nothing useful externally.
|
|
|
|
|
|
[old-dbus-example]: https://wiki.gnome.org/Gjs/Examples/DBusClient
|
|
|
|
|
|
## Standalone Applications
|
|
|
|
... | ... | @@ -58,8 +90,7 @@ Gnome Applications written in GJS: |
|
|
* Mailing List: http://mail.gnome.org/mailman/listinfo/javascript-list
|
|
|
* IRC: irc://irc.gnome.org/#javascript
|
|
|
* Issue/Bug Tracker: https://gitlab.gnome.org/GNOME/gjs/issues
|
|
|
|
|
|
There is also a [gjs](https://stackoverflow.com/questions/tagged/gjs) tag on StackOverflow with a number of subscribers ready to help.
|
|
|
* StackOverflow: https://stackoverflow.com/questions/tagged/gjs
|
|
|
|
|
|
## External Links
|
|
|
|
... | ... | |