From f70303544865ff8baf660367f5c3975483926009 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 29 May 2018 18:10:05 +0200 Subject: [PATCH] Application Loader Script Implemented --- AccumulatedVolumeBar.js | 12 --------- Project.njsproj | 7 ++++- Scripts/AppLoader.js | 59 +++++++++++++++++++++++++++++++++++++++++ Scripts/AppPreLoader.js | 17 ++++++++++++ index.html | 21 ++++----------- 5 files changed, 87 insertions(+), 29 deletions(-) delete mode 100644 AccumulatedVolumeBar.js create mode 100644 Scripts/AppLoader.js create mode 100644 Scripts/AppPreLoader.js diff --git a/AccumulatedVolumeBar.js b/AccumulatedVolumeBar.js deleted file mode 100644 index 191a44b46..000000000 --- a/AccumulatedVolumeBar.js +++ /dev/null @@ -1,12 +0,0 @@ -function newAccumulatedVolumeBar() { - - var accumulatedVolumeBar = { - begin: undefined, - end: undefined, - accumulatedBuys: 0, - accumulatedSells: 0 - }; - - return accumulatedVolumeBar; - -} \ No newline at end of file diff --git a/Project.njsproj b/Project.njsproj index c06abbfb7..49201a4b3 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -32,7 +32,6 @@ Code - @@ -43,6 +42,12 @@ + + Code + + + Code + Code diff --git a/Scripts/AppLoader.js b/Scripts/AppLoader.js new file mode 100644 index 000000000..393581f5a --- /dev/null +++ b/Scripts/AppLoader.js @@ -0,0 +1,59 @@ +function newAppLoader() { + + const FULL_LOG = false; + const LOG_FILE_CONTENT = false; + + const MODULE_NAME = "App Loader"; + + const logger = newWebDebugLog(); + logger.fileName = MODULE_NAME; + + let thisObject = { + loadModules: loadModules + }; + + return thisObject; + + function loadModules() { + + let modulesArray = [ + + "ViewPort.js", + "TimeMachine.js", + "Candle.js", + "VolumeBar.js", + "ChartUtilities.js", + "TimelineChart.js", + "ChartGrid.js", + "Animation.js", + + "Container.js", + "Displace.js", + + "Azure/azure-storage.blob.js", + "TimeLineCoordinateSystem.js", + "Utilities.js", + "Dashboard.js" + ]; + + let downloadedCounter = 0; + + for (let i = 0; i < modulesArray.length; i++) { + + let path = modulesArray[i]; + + REQUIREJS([path], onRequired); + + function onRequired(pModule) { + + console.log(path + " downloaded."); + downloadedCounter++; + + if (downloadedCounter === modulesArray.length) { + + dashboardStart(); // This formally starts the app. + } + } + } + } +} \ No newline at end of file diff --git a/Scripts/AppPreLoader.js b/Scripts/AppPreLoader.js new file mode 100644 index 000000000..c4bcb4a4f --- /dev/null +++ b/Scripts/AppPreLoader.js @@ -0,0 +1,17 @@ + +function loadAPP() { + + let path = "Scripts/AppLoader.js"; + + REQUIREJS([path], onRequired); + + function onRequired(pModule) { + + console.log(path + " downloaded."); + + let APP_LOADER_MODULE = newAppLoader(); + APP_LOADER_MODULE.loadModules(); + + } +} + diff --git a/index.html b/index.html index b2179ef31..247040538 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@ Advanced Algos + @@ -33,22 +34,10 @@ - - - - - - - - - - - - - - - + + + @@ -78,7 +67,7 @@ } - +