Skip to content

Commit

Permalink
frontend/qttransport: fully initialize channel before returning it
Browse files Browse the repository at this point in the history
I didn't observe a bug, but it is probably good to fully initialize
the channel before returning it.
  • Loading branch information
benma committed Oct 12, 2022
1 parent 2475d8e commit 2fbc8f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontends/web/src/utils/qttransport.ts
Expand Up @@ -32,17 +32,17 @@ async function initTransport() {
return webChannel;
}
const initWebChannel = function(channel: any) {
webChannel = channel;
webChannel.objects.backend.gotResponse.connect((
channel.objects.backend.gotResponse.connect((
queryID: number,
response: string,
) => {
queryPromises[queryID].resolve(JSON.parse(response));
delete queryPromises[queryID];
});
webChannel.objects.backend.pushNotify.connect((msg: string) => {
channel.objects.backend.pushNotify.connect((msg: string) => {
currentListeners.forEach(listener => listener(JSON.parse(msg)));
});
webChannel = channel;
};
new QWebChannel((window.qt!).webChannelTransport, initWebChannel);
while (!webChannel) {
Expand Down

0 comments on commit 2fbc8f0

Please sign in to comment.