From 7fb300a72688d6a45cfaef73c69bbecee5255c03 Mon Sep 17 00:00:00 2001 From: Brian Peiris <brianpeiris@gmail.com> Date: Thu, 10 May 2018 14:25:50 -0700 Subject: [PATCH] refactor querystring check --- src/hub.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hub.js b/src/hub.js index 06d6a3432..a6efe81c6 100644 --- a/src/hub.js +++ b/src/hub.js @@ -128,6 +128,7 @@ AFRAME.registerInputActivator("pressedmove", PressedMove); AFRAME.registerInputActivator("reverseY", ReverseY); AFRAME.registerInputMappings(inputConfig, true); +const isBotMode = qsTruthy("bot"); const concurrentLoadDetector = new ConcurrentLoadDetector(); concurrentLoadDetector.start(); @@ -303,7 +304,7 @@ const onReady = async () => { return; }); - if (qsTruthy("bot")) { + if (isBotMode) { playerRig.setAttribute("avatar-replay", { camera: "#player-camera", leftController: "#player-left-controller", @@ -371,7 +372,7 @@ const onReady = async () => { initialEnvironmentEl.addEventListener("bundleloaded", () => { remountUI({ initialEnvironmentLoaded: true }); // We never want to stop the render loop when were running in "bot" mode. - if (!qsTruthy("bot")) { + if (!isBotMode) { // Stop rendering while the UI is up. We restart the render loop in enterScene. // Wait a tick plus some margin so that the environments actually render. setTimeout(() => scene.renderer.animate(null), 100); @@ -380,7 +381,7 @@ const onReady = async () => { environmentRoot.appendChild(initialEnvironmentEl); const setRoom = (janusRoomId, hubName) => { - if (qsTruthy("bot")) { + if (isBotMode) { const enterSceneImmediately = () => enterScene(new MediaStream(), false, janusRoomId); if (scene.hasLoaded) { enterSceneImmediately(); -- GitLab