Re: Importing custom modules in Gjs



Hello Jasper, 

On Sun, Aug 5, 2012 at 5:57 PM, Jasper St. Pierre <jstpierre mecheye net> wrote:
On Sun, Aug 5, 2012 at 10:02 AM, alex diavatis
<alexis diavatis gmail com> wrote:
> Hello,
>
> 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} );

You need to import Clutter as well:

const Clutter = imports.gi.Clutter;

Of course I have Clutter imported. 
I just can't find a way to call black_c from conf.js to main.js. When I call it it I get:
ReferenceError: black_c is not defined 

> and I cannot find a way to call this variable from my main.js file.
>
> - alex
>
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
>



--
  Jasper



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