From 2d5f03a709dc56477402630e56e51bfd615c7946 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 17:17:04 +0100 Subject: [PATCH] Deleting UI Object fix --- FloatingSpace/CircularMenuItem.js | 6 +++++- FloatingSpace/CircularProgressBar.js | 4 +++- FloatingSpace/UiObject.js | 9 +++++++-- SystemEventHandler.js | 4 +++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index ca2d77c7e..ce0cd313e 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -279,7 +279,11 @@ function newCircularMenuItem () { /* A Click during confirmation executes the pre-defined action. */ if (temporaryStatus === STATUS_WAITING_CONFIRMATION || temporaryStatus === STATUS_PRIMARY_WORK_DONE) { executeAction() - setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + if (thisObject.workDoneLabel !== undefined) { + setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + } else { + setStatus('Done', UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + } return } } diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 07973d7ee..a78943473 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -31,7 +31,9 @@ function newCircularProgressBar () { function finalize () { let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat) + if (eventSubscriptionIdHeartbeat !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat) + } thisObject.container = undefined thisObject.payload = undefined diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 96955b532..9f6999404 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -120,8 +120,13 @@ function newUiObject () { function finalize () { let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.stopListening(key, eventSubscriptionIdOnRunning, 'UiObject') - systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject') + + if (eventSubscriptionIdOnRunning !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdOnRunning, 'UiObject') + } + if (eventSubscriptionIdOnStopped !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject') + } thisObject.container.eventHandler.stopListening(selfFocusEventSubscriptionId) thisObject.container.eventHandler.stopListening(selfNotFocusEventSubscriptionId) diff --git a/SystemEventHandler.js b/SystemEventHandler.js index 07618cbf8..d8c4b520c 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -44,7 +44,9 @@ function newSystemEventHandler () { responseWaiters.set(command.callerId, responseCallBack) } - WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + if (WEB_SOCKETS_CONNECTION.readyState === 1) { // 1 means connected and ready. + WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + } } function createEventHandler (eventHandlerName, callerId, responseCallBack) {