|
|
# Gjs: Javascript Bindings for GNOME
|
|
|
# GJS: Javascript Bindings for the Gnome Desktop and APIs
|
|
|
|
|
|
Gjs is a Javascript binding for GNOME. It's mainly based on Spidermonkey javascript engine and the GObject introspection framework.
|
|
|
The current stable series (1.50.x) is built on Mozilla's SpiderMonkey 52 featuring **ES6 (ECMAScript 2015)** and GObjectIntrospection making most of the **Gnome API library** available.
|
|
|
|
|
|
If you use it, especially for GNOME-related projects, please follow the [Style Guide](). Otherwise, JavaScript is so free-form that code becomes very difficult to maintain.
|
|
|
|
|
|
## Documentation
|
|
|
|
|
|
GJS 1.50 is built on Mozilla's SpiderMonkey 52 and ES6 support (ECMAScript 2015) is nearly complete. Generally you can use the [MDN JavaScript Reference][mdn-reference] and check the feature's [Browser Compatibility][mdn-compatibility] table for Firefox.
|
|
|
|
|
|
To confirm if or when a language feature was implemented in GJS (e.g. `Object.values()`, `async function`), 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 GJS classes](Modules#lang).
|
|
|
To find out when a language feature was implemented in GJS, review [NEWS][gjs-news] in the GitLab repository. In many cases older versions of GJS can be supported using [polyfills][mdn-polyfills] and [legacy-style GJS classes](Modules#lang).
|
|
|
|
|
|
GJS includes some built-in modules like Cairo and Gettext, as well as helpers for some core APIs like DBus and Variants. See the [Modules](Modules) page for an overview of the built-in modules and their usage.
|
|
|
|
|
|
[mdn-compatibility]: https://developer.mozilla.org//docs/MDN/Contribute/Structures/Compatibility_tables
|
|
|
[gjs-news]: https://gitlab.gnome.org/GNOME/gjs/raw/master/NEWS
|
|
|
[mdn-polyfills]: https://developer.mozilla.org/docs/Glossary/Polyfill
|
|
|
[mdn-reference]: https://developer.mozilla.org/docs/Web/JavaScript/Reference
|
|
|
|
|
|
### Gnome API
|
|
|
## Gnome API Documentation
|
|
|
|
|
|
There is now official [Gnome API Documentation][gjs-docs] including everything from GLib and Gtk to Soup and WebKit2.
|
|
|
There is now official [Gnome API Documentation][gjs-docs] for GJS, including everything from GLib and Gtk to Soup and WebKit2.
|
|
|
|
|
|
The [Mapping](Mapping) page has an overview of Gnome API usage in GJS such as subclassing, constants and flags, functions with multiple return values, and more.
|
|
|
|
... | ... | @@ -26,14 +19,13 @@ There are also a growing number of [examples][gjs-examples] and thorough tests o |
|
|
|
|
|
[gjs-docs]: https://devdocs.baznga.org/
|
|
|
[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
|
|
|
|
|
|
|
|
|
|
|
|
## Standalone Applications
|
|
|
|
|
|
It's possible to write standalone applications with GJS for the Gnome Desktop, and there are helpers available for Gettext, GSettings and GResources via the `package` import. There is a package specification, template repository available and plans for an in depth tutorial.
|
|
|
It's possible to write standalone applications with GJS for the Gnome Desktop, and infrastructure for Gettext, GSettings and GResources via the `package` import. There is a package specification, template repository available and plans for an in depth tutorial.
|
|
|
|
|
|
* [GJS Package Specification](https://wiki.gnome.org/Projects/Gjs/Package)
|
|
|
* [GJS Package Template](https://github.com/gcampax/gtk-js-app)
|
... | ... | @@ -57,4 +49,4 @@ Gnome Applications written in GJS: |
|
|
## External Links
|
|
|
|
|
|
* [GObjectIntrospection](https://wiki.gnome.org/action/show/Projects/GObjectIntrospection)
|
|
|
* [Gnome Developer Platform Demo](https://developer.gnome.org/gnome-devel-demos/stable/js.html) |
|
|
\ No newline at end of file |
|
|
* [Gnome Developer Platform Demo](https://developer.gnome.org/gnome-devel-demos/stable/js.html) (Some older examples that still might be informative) |
|
|
\ No newline at end of file |