Add support for JS async calls in DBusProxyWrapper
Currently, DBusProxyWrapper dynamically creates two methods for each method available in the DBus interface: one with the suffix Sync (which blocks the calling thread until the call returns), and another with the suffix Remote (which accepts a callback, called when the DBus calls returns).
Since GJS has support for async/await, it is a good idea to use them for DBus. Unfortunately, that means creating some plumbing using Promises. It is not complex, but it is a repetitive task.
This MR fixes this by adding a third method, suffixed with Async, that returns a Promise that calls the DBus method and returns the result with resolve
(or reject
if an error occurs). This allows to call a DBus method from an async function and wait for the result using await
.