Hi everybody, I run into an issue while developing an extension for Gnome Shell. Long running Javascript code can make the whole Gnome Shell unresponsive for a second. Since I cannot reduce the execution time of the long running code, I want to move it out of the main loop's thread to a new one to make the UI update independent. I found that the best way would be to create a GTask <https://developer.gnome.org/gio/unstable/GTask.html> to run my synchronous JS code asynchronously.
So I tried something like this: let task = imports.gi.Gio.Task.new( Lang.bind(this, function(){ /* do the heavy work */ }), null, Lang.bind(this, function(){ /* handle the result when ready */ }),); But that does not work, because the first argument is not a *GObject*, but a JS function. I think that a passing a GClosure <https://developer.gnome.org/gobject/unstable/gobject-Closures.html> instead could work. Here is how I tries to instantiate it: let closure = new imports.gi.GObject.Closure(function(){}, new imports.gi.GObject.Object); Unfortunately this does not work either, probably the first argument has to be a *GCallback*. Can I get some assistance? Thanks in advance. Regards, Geza -- Üdvözlettel, Búza Géza
_______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list