diff --git a/.gitignore b/.gitignore index bbcbadf2b6..c3cb03f201 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,8 @@ local.properties !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +# Workspace +*.code-workspace # Xcode *.xcodeproj diff --git a/interface/resources/html/createGlobalEventBridge.js b/interface/resources/html/createGlobalEventBridge.js index 11616c051a..7fdf700161 100644 --- a/interface/resources/html/createGlobalEventBridge.js +++ b/interface/resources/html/createGlobalEventBridge.js @@ -1,8 +1,6 @@ -// -// createGlobalEventBridge.js -// // Created by Anthony J. Thibault on 9/7/2016 // Copyright 2016 High Fidelity, Inc. +// Copyright 2023 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -25,37 +23,40 @@ var EventBridge; this.emitWebEvent = function (message) { self._messages.push(message); }; - }; + } EventBridge = new TempEventBridge(); - var webChannel = new QWebChannel(qt.webChannelTransport, function (channel) { + var webChannel = new QWebChannel(qt.webChannelTransport, (channel) => { + // // replace the TempEventBridge with the real one. var tempEventBridge = EventBridge; EventBridge = channel.objects.eventBridge; + + // TODO: These event listeners cause issues. Most likely the function is not being exposed to this scope. This may be causing issues! // To be able to update the state of the output device selection for every element added to the DOM // we need to listen to events that might precede the addition of this elements. // A more robust hack will be to add a setInterval that look for DOM changes every 100-300 ms (low performance?) - - window.addEventListener("load",function(event) { - setTimeout(function() { - EventBridge.forceHtmlAudioOutputDeviceUpdate(); - }, 1200); - }, false); - - document.addEventListener("click",function(){ - setTimeout(function() { - EventBridge.forceHtmlAudioOutputDeviceUpdate(); - }, 1200); - }, false); - - document.addEventListener("change",function(){ - setTimeout(function() { - EventBridge.forceHtmlAudioOutputDeviceUpdate(); - }, 1200); - }, false); - + + // window.addEventListener("load",function(event) { + // setTimeout(function() { + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // }, 1200); + // }, false); + + // document.addEventListener("click",function(){ + // setTimeout(function() { + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // }, 1200); + // }, false); + + // document.addEventListener("change",function(){ + // setTimeout(function() { + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // }, 1200); + // }, false); + tempEventBridge._callbacks.forEach(function (callback) { EventBridge.scriptEventReceived.connect(callback); });