Load avatar browser dialog such that JavaScript EventBridge works

This commit is contained in:
David Rowe 2016-10-11 11:12:57 +13:00
parent d0900ec75e
commit 552f276a06
2 changed files with 5 additions and 10 deletions

View file

@ -40,13 +40,13 @@
if (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard) { if (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard) {
if (typeof EventBridge !== "undefined") { if (typeof EventBridge !== "undefined" && EventBridge !== null) {
EventBridge.emitWebEvent( EventBridge.emitWebEvent(
keyboardRaised ? ("_RAISE_KEYBOARD" + (numericKeyboard ? "_NUMERIC" : "")) : "_LOWER_KEYBOARD" keyboardRaised ? ("_RAISE_KEYBOARD" + (numericKeyboard ? "_NUMERIC" : "")) : "_LOWER_KEYBOARD"
); );
} else { } else {
if (numWarnings < MAX_WARNINGS) { if (numWarnings < MAX_WARNINGS) {
console.log("WARNING: no global EventBridge object found"); console.log("WARNING: No global EventBridge object found");
numWarnings++; numWarnings++;
} }
} }

View file

@ -74,11 +74,6 @@ Preference {
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
} }
Component {
id: avatarBrowserBuilder;
AvatarBrowser { }
}
Button { Button {
id: button id: button
text: "Browse" text: "Browse"
@ -87,12 +82,12 @@ Preference {
verticalCenter: dataTextField.verticalCenter verticalCenter: dataTextField.verticalCenter
} }
onClicked: { onClicked: {
root.browser = avatarBrowserBuilder.createObject(desktop); // Load dialog via OffscreenUi so that JavaScript EventBridge is available.
root.browser = OffscreenUi.load("dialogs/preferences/AvatarBrowser.qml");
root.browser.windowDestroyed.connect(function(){ root.browser.windowDestroyed.connect(function(){
root.browser = null; root.browser = null;
}) });
} }
} }
} }
} }