From dcbe60f5a516d64db6530e2add61905f3ae83b4a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 23 Sep 2019 14:54:07 +0200 Subject: [PATCH] Sequence Files Initialization Fixed --- Dashboard.js | 9 +++++++++ ProductStorage.js | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index ac0507ce8..0794dc76f 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -33,6 +33,8 @@ function newDashboard () { function start () { try { + setBrowserEvents() + systemEventHandler = newSystemEventHandler() systemEventHandler.initialize(startCanvas) @@ -107,4 +109,11 @@ function newDashboard () { if (ERROR_LOG === true) { logger.write('[ERROR] browserResized -> err = ' + err.stack) } } } + + function setBrowserEvents () { + window.onbeforeunload = onBrowserClosed + function onBrowserClosed () { + window.alert('My Window is closing') + } + } } diff --git a/ProductStorage.js b/ProductStorage.js index acd829022..371270b90 100644 --- a/ProductStorage.js +++ b/ProductStorage.js @@ -257,10 +257,19 @@ function newProductStorage (pName) { return } } - let event = { - totalValue: pCaller.getExpectedFiles(), - currentValue: pCaller.getFilesLoaded() + let event + if (pCaller !== undefined) { + event = { + totalValue: pCaller.getExpectedFiles(), + currentValue: pCaller.getFilesLoaded() + } + } else { // When there are no data the reference to the caller wont arrive here. + event = { + totalValue: 1, + currentValue: 1 + } } + thisObject.eventHandler.raiseEvent('File Sequence Loaded', event) if (event.currentValue === event.totalValue) {