2017-11-15 19:46:47 +01:00
|
|
|
"use strict";
|
2017-11-15 20:19:15 +01:00
|
|
|
|
2017-11-16 23:08:14 +01:00
|
|
|
/*
|
|
|
|
* This file contains the main control flow.
|
|
|
|
*/
|
|
|
|
|
2017-11-15 20:09:59 +01:00
|
|
|
console.log("Let's load and preprocess all data properly.");
|
2017-11-15 19:46:47 +01:00
|
|
|
|
2017-11-16 23:08:14 +01:00
|
|
|
// Show loading dialog
|
|
|
|
loadingDialog.show(13);
|
2017-11-15 21:22:05 +01:00
|
|
|
|
2017-11-15 20:09:59 +01:00
|
|
|
// Create a queue, add all the fetch&process functions and await their results
|
|
|
|
d3.queue()
|
2017-11-16 23:21:54 +01:00
|
|
|
.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)
|
2017-11-15 20:25:44 +01:00
|
|
|
.awaitAll(function(error) {
|
2017-11-15 20:19:15 +01:00
|
|
|
// All data loaded by the deferred functions, now we're ready for business
|
|
|
|
// (call more functions :D)
|
2017-11-15 20:09:59 +01:00
|
|
|
console.log("All done. Ready.");
|
2017-11-15 20:41:46 +01:00
|
|
|
// Throw errors so we can see them
|
2017-11-15 20:09:59 +01:00
|
|
|
if(error) throw error;
|
2017-11-16 23:08:14 +01:00
|
|
|
// Hide the loading dialog
|
|
|
|
loadingDialog.hide();
|
2017-11-15 20:09:59 +01:00
|
|
|
});
|