repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 5c590f30c41e6baaecd8daf2af0c4d3c5a8bb5ed:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 5c590f30c41e6baaecd8daf2af0c4d3c5a8bb5ed
Author: James Baicoianu 
Date:   Tue Jul 23 12:05:08 2019 -0700

    Don't autload room until assets.json has loaded

diff --git a/scripts/janusweb.js b/scripts/janusweb.js
index e437732534388ff4033ec2724e13058a51800b09..
index ..a400a03e9fbad8319a074f0264b1655fec565b69 100644
--- a/scripts/janusweb.js
+++ b/scripts/janusweb.js
@@ -111,10 +111,11 @@ elation.require([
         elation.template.add('janusweb.url', this.urltemplate);
       }
       this.initScripting();
-      // TODO - this should be config-driven

       this.assetpack.executeWhenLoaded(() => {
-        this.registerAdditionalElements(['raycaster', 'teleporter']);
+        // TODO - this should be config-driven
+        this.registerAdditionalElements(['raycaster']);
+        this.initRoom();
       });
     }
     this.initScripting = function() {
@@ -256,8 +257,6 @@ elation.require([
     }

     this.createChildren = function() {
-      var hashargs = elation.url();
-      var starturl = hashargs['janus.url'] || this.properties.url || this.properties.homepage;
       var player = this.engine.client.player;
       //setTimeout(elation.bind(this, this.load, starturl, true), 5000);
       //this.initScripting();
@@ -267,13 +266,20 @@ elation.require([
       if (this.networking) {
         this.network.enable(player);
       }
+      if (!(this.autoload || starturl != this.properties.homepage)) {
+        player.disable();
+      }
+    }
+
+    this.initRoom = function() {
+      var hashargs = elation.url();
+      var starturl = hashargs['janus.url'] || this.properties.url || this.properties.homepage;

       if (this.autoload || starturl != this.properties.homepage) {
         this.load(starturl, true);
-      } else {
-        player.disable();
       }
     }
+
     this.clear = function() {
       if (this.currentroom) {
         this.remove(this.currentroom);

-----END OF PAGE-----