I’m trying to call CLib API from Seed. In JS there is a setTimout API. But not in Seed.
So I use GLib to make a delay function:
delay = function(time, func) {
return GLib.timeout_add(time, func);
};
It gives error:
(seed:26406): GLib-CRITICAL **: g_timeout_add_full: assertion `function != NULL' failed
** (seed:26406): CRITICAL **: Line 9 in w.js: ConversionError Can not convert Javascript value to boolean
What is the right way to write it?
Since I didn’t found an detailed JS API for Seed. I tried to read the docs for C.
And it looks awful..
http://developer.gnome.org/pygobject/stable/glib-functions.html#function-glib–get-current-time
GLib.timeout_add corresponds to g_timeout_add_full. You’re missing an argument (the priority)… the third argument should be the callback, but since you’re not passing anything seed will try to use NULL.
There is an example of using a timeout in Seed in glib/timeout.js in the seed-examples repository.