- 
    
Suggestion
 - 
    Resolution: Unresolved
 - 
    
P3: Somewhat important
 - 
    None
 - 
    5.9.4
 - 
    None
 
#2 from QTBUG-67592
in some cases we would like to retrieve the result of a slot synchronously so I propose to wrap the slot invocation in a Promise when there is no callback so that client code may use 'await'
function addMethod(methodData) {
...
if (callback) {
                webChannel.exec({
                    "type": QWebChannelMessageTypes.invokeMethod,
                    "object": object.__id__,
                    "method": methodIdx,
                    "args": args
                }, function (response) {
                    if (response !== undefined) {
                        var result = object.unwrapQObject(response);
                        (callback)(result);
                    }
                });
            } else {
                var promise = new Promise(function (resolve, reject) {
                    webChannel.exec({
                        "type": QWebChannelMessageTypes.invokeMethod,
                        "object": object.__id__,
                        "method": methodIdx,
                        "args": args
                    }, function (response) {
                        if (response !== undefined) {
                            var result = object.unwrapQObject(response);
                            resolve(result);
                        } else {
                            resolve();
                        }
                    });
                });
                return promise;
            }
}