... | ... | @@ -53,6 +53,15 @@ Mostly GObject implementation (properties, signals, GType mapping). May be usefu |
|
|
|
|
|
Mostly GtkBuilder/composite template implementation. May be useful as a reference.
|
|
|
|
|
|
>>>
|
|
|
**REMINDER:** You should specify a version prior to importing a library with multiple versions:
|
|
|
|
|
|
```js
|
|
|
imports.gi.versions.Gtk = "3.0";
|
|
|
const Gtk = imports.gi.Gtk;
|
|
|
```
|
|
|
>>>
|
|
|
|
|
|
## Cairo
|
|
|
|
|
|
**Import with `const Cairo = imports.cairo;`**
|
... | ... | @@ -89,9 +98,7 @@ drawingArea.connect("draw", (widget, cr) => { |
|
|
|
|
|
**Import with `const Format = imports.format;`**
|
|
|
|
|
|
The format import provides `vprintf()`, `printf()` and the `format()` method for applying to `String.prototype`.
|
|
|
|
|
|
**NOTE:** Native [template literals][template-literals] should be preferred except in few situations like Gettext (See [Bug #50920][bug-50920]).
|
|
|
The format import is mostly obsolete, providing `vprintf()`, `printf()` and `format()`. Native [template literals][template-literals] should be preferred now, except in few situations like Gettext (See [Bug #50920][bug-50920]).
|
|
|
|
|
|
```js
|
|
|
let foo = "Pi";
|
... | ... | @@ -138,7 +145,7 @@ Deprecated unit test functions. [Jasmine][jasmine-gjs] for GJS should now be pre |
|
|
|
|
|
**`DEPRECATED`**
|
|
|
|
|
|
Lang is a mostly obsolete library supporting the legacy classes in GJS. For example, `Lang.bind()` was necessary to bind `this` to the function context before the availability of arrow functions:
|
|
|
Lang is a mostly obsolete library, that should only be used in cases where older versions of GJS must be supported. For example, `Lang.bind()` was necessary to bind `this` to the function context before the availability of arrow functions:
|
|
|
|
|
|
```js
|
|
|
const Lang = imports.lang;
|
... | ... | |