Getting the result of a DBus method call.



Hi all,

I'm taking first steps learning how to use DBus in a gnome shell extension.

I've hit a stumbling block - how do I get the result of a remote
method immediately?

Something like:

   let value = dbusProxy.<methodname>Remote(/* arguments ... */,
function (result) { ???? how to return it???? });

In the usage above, I want the `result` in the callback to be assigned
to value so that if my next line of code is (say)

    log(value);

this will be up-to-date.

Otherwise, I could do something like:

    let value;
    dbusProxy.<methodname>Remote(/* arguments ... */, function
(result) { value = result; });
    log(value);

but when I do this, 'value' is not up to date (until the callback
completes), so I can't rely on the above code if I want to use 'value'
straight away.

Is there some way around this?


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