Re: Importing custom modules in Gjs



hi;

On 5 August 2012 15:02, alex diavatis <alexis diavatis gmail com> wrote:
> I am starting an App with Gjs and Clutter but I am stacked as I cannot
> import custom classes in gjs path, from inside the application and not from
> /usr/bin/gjs
>
> I am trying something like:
>
> const Me = imports.searchPath.unshift('.');
> const myConf = Me.conf;
>
> which imports the conf.js file, but then I want to use inside there for
> example
>
> let black_c = new Clutter.Color( {red:0, blue:0, green:0, alpha:255} );
>
> and I cannot find a way to call this variable from my main.js file.

side note, given that you're trying to define static colors: Clutter
already does that for you.

see: http://developer.gnome.org/clutter/stable/clutter-Colors.html#clutter-color-get-static

and the enumeration for static colors available at:

http://developer.gnome.org/clutter/stable/clutter-Colors.html#ClutterStaticColor

in JS it should look something like:

  let color = Clutter.Color.get_static(Clutter.StaticColor.BLACK)

all the colors defined in the enumeration are guaranteed to exist
during the execution of a Clutter app.

ciao,
 Emmanuele

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]