From 79ce12298863737ea714157e469f2a56f783aac0 Mon Sep 17 00:00:00 2001 From: roblevesque Date: Thu, 7 Jul 2016 12:10:12 -0400 Subject: [PATCH] Add Callback for data loading --- mapview/js/mapviewgl.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mapview/js/mapviewgl.js b/mapview/js/mapviewgl.js index 4593454..7cdabfb 100644 --- a/mapview/js/mapviewgl.js +++ b/mapview/js/mapviewgl.js @@ -8,13 +8,14 @@ var clock = new THREE.Clock(); var WIDTH = window.innerWidth , HEIGHT = window.innerHeight window.onload = function() { -loadData(); +loadData( { init(); animate(); render(); +}); } -function loadData() { +function loadData(_callback) { // Load Data (hopefully) before the rest of the place loads. var xmlhttp = new XMLHttpRequest(); var url = "js/empiredata.json"; @@ -27,6 +28,7 @@ function loadData() { }; xmlhttp.open("GET", url, true); xmlhttp.send(); + _callback(); } function init() { scene = new THREE.Scene();