Pregunta

If I'm looking at Gjs code and see this line near the beginning:

const Gio = imports.gi.Gio;

How can I know what methods, constants, events, etc. are on 'Gio' (without doing a Google search)? Is there a file somewhere on my installation that contains that information?

Obviously I'm asking for any 'imports' statement, not Gio specifically.

¿Fue útil?

Solución

Some of imports statements import other javascript files:

  • imports.ui.* -> /usr/share/cinnamon/js/ui/*
  • imports.misc.* -> /usr/share/cinnamon/js/misc/*
  • imports.[cairo, dbus, format, gettext, jsUnit, lang, promise, signals] -> /usr/share/gjs-1.0/

For the imports.gi imports, Gnome Introspection is used to allow gjs to use C library.
So to get informations about those libraries I suggest you to look at the Gnome reference manuals:

But to conclude, there is a huge lack of documentation and examples. That makes difficult to develop with gjs.

UPDATE
Here other useful links:

Otros consejos

Since I got no answers I kept searching online and found this excellent blog post on how to generate HTML-formatted documentation from typelib files (such as Gio-2.0.typelib):

http://mathematicalcoffee.blogspot.com/2012/09/developing-gnome-shell-extensions_6.html

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top