f1vis/js/main.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

"use strict";
2017-11-16 23:08:14 +01:00
/*
* This file contains the main control flow.
*/
console.log("Let's load and preprocess all data properly.");
2017-11-16 23:08:14 +01:00
// Show loading dialog
loadingDialog.show(13);
2017-11-15 21:22:05 +01:00
// Create a queue, add all the fetch&process functions and await their results
d3.queue()
.defer(preprocessor.fetchCircuits)
.defer(preprocessor.fetchConstructorResults)
.defer(preprocessor.fetchConstructors)
.defer(preprocessor.fetchConstructorStandings)
.defer(preprocessor.fetchDrivers)
.defer(preprocessor.fetchDriverStandings)
.defer(preprocessor.fetchLapTimes)
.defer(preprocessor.fetchPitStops)
.defer(preprocessor.fetchQualifying)
.defer(preprocessor.fetchRaces)
.defer(preprocessor.fetchResults)
.defer(preprocessor.fetchSeasons)
.defer(preprocessor.fetchStatus)
.awaitAll(function(error) {
// All data loaded by the deferred functions, now we're ready for business
// (call more functions :D)
console.log("All done. Ready.");
2017-11-15 20:41:46 +01:00
// Throw errors so we can see them
if(error) throw error;
2017-11-16 23:08:14 +01:00
// Hide the loading dialog
loadingDialog.hide();
});