Re: Use user_data in callback
- From: Jay Strict <jay strict posteo de>
- To: Norman L Smith <nls1729 gmail com>, gnome-shell-list gnome org
- Subject: Re: Use user_data in callback
- Date: Thu, 24 Sep 2015 09:12:30 +0200
Nice, thank you,
your answers help a lot in learning this entire gnome-shell stuff.
Best regards,
Jay
On 23.09.2015 16:46, Norman L Smith wrote:
Jay,
See https://git.gnome.org/browse/gjs/tree/modules if you have not
done so. I did not think about the fact that your distro might
not provide the files I referenced.
Sorry about that..
Norman
On Wed, 2015-09-23 at 14:52 +0200, Jay Strict wrote:
On 23.09.2015 12:45, Norman L Smith wrote:
Hello Jay,
From /usr/share/gnome-js/signals.js
Where do I find this file "signals.js"? It is not in my file system
tree.
function _connect(name, callback) {
The connect takes two arguments.
The callback argument, without binding additional arguments to
the callback, consists of only the function and its first and
second argument.
lang.bind as noted in the comments below provides for the use
of "this" in the body of the callback function and binding
additional arguments to the callback function.
From /usr/share/gnome-js/lang.js
Again, no file "lang.js", neither in /usr/share/gnome-shell/** nor in
/usr/** nor in https://github.com/GNOME/gnome-shell.git
/**
* Binds obj to callback. Makes it possible to refer to "obj"
* using this within the callback.
* @param {object} obj the object to bind
* @param {function} callback callback to bind obj in
* @param arguments additional arguments to the callback
* @returns: a new callback
* @type: function
*/
You will not see many examples of using the binding of additional
arguments because of "this" being available in the callback
function.
Ah ok, I see that you don't need additional arguments when you have
"this" available.
Kind regards,
Jay
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]