Add Callback for data loading

This commit is contained in:
roblevesque 2016-07-07 12:10:12 -04:00 committed by GitHub
parent 677dc706ee
commit 79ce122988

View File

@ -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();