Merge pull request #98 from AAMasters/develop

Running all tasks in safe mode
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2019-09-23 13:08:59 +02:00
commit 88265a8c16
17 files changed
+713 -485

No files matched your search

+2 -2
View File
@@ -462,11 +462,12 @@ function newPlottersManager () {
canvas.panelsSpace.destroyPanel(productPlotters[i].panels[j])
}
/* Finally the Storage Objects */
productPlotters[i].storage.finalize()
if (productPlotters[i].plotter.finalize !== undefined) {
productPlotters[i].plotter.container.finalize()
productPlotters[i].plotter.finalize()
}
productPlotters[i].storage.finalize()
productPlotters.splice(i, 1) // Delete item from array.
return // We already found the product woth changes and processed it.
}
@@ -530,4 +531,3 @@ function newPlottersManager () {
}
}
}
+12 -17
View File
@@ -35,9 +35,9 @@ function newRestartSimulation () {
let executionFocusExists = false
let idleLabel = ''
let refreshCounter = 0
let isRunning = false
let eventSubscriptionId
let eventSubscriptionIdProcessStopped
return thisObject
@@ -46,7 +46,8 @@ function newRestartSimulation () {
thisObject.container.eventHandler.stopListening(selfMouseClickEventSubscriptionId)
thisObject.container.eventHandler.stopListening(selfMouseNotOverEventSubscriptionId)
systemEventHandler.stopListening('Jason-Multi-Period', eventSubscriptionId)
systemEventHandler.stopListening('Jason-Multi-Period', eventSubscriptionIdProcessStopped)
systemEventHandler.deleteEventHandler('Cockpit-Restart-Button')
thisObject.container.finalize()
thisObject.container = undefined
@@ -64,20 +65,15 @@ function newRestartSimulation () {
systemEventHandler.createEventHandler('Cockpit-Restart-Button')
/*
We will start listening to the event that is triggered when the simulation process finishes processing one day in the case
of daily files or the whole market in the case of market files.
*/
eventSubscriptionId = systemEventHandler.listenToEvent('Jason-Multi-Period', 'Status Report Updated', undefined, undefined, undefined, onEvent)
systemEventHandler.listenToEvent('Jason-Multi-Period', 'Process Stopped', undefined, 'Cockpit-Restart-Button', onResponse, onProcessStopped)
function onEvent (message) {
refreshCounter++
function onResponse (message) {
eventSubscriptionIdProcessStopped = message.eventSubscriptionId
}
if (refreshCounter === 1) {
refreshCounter = 0
turnOffProductCards()
turnOnProductCards()
}
function onProcessStopped (message) {
thisObject.status = 'Ready'
isRunning = false
}
}
@@ -144,7 +140,6 @@ function newRestartSimulation () {
systemEventHandler.raiseEvent('Cockpit-Restart-Button', 'Stop Requested')
isRunning = false
thisObject.status = 'Stopping'
counterTillNextState = 200
}
} catch (err) {
thisObject.status = 'Error'
@@ -200,7 +195,7 @@ function newRestartSimulation () {
break
case 'Stopping':
thisObject.status = 'Ready'
break
case 'Error':
thisObject.status = 'Ready'
+38 -14
View File
@@ -5,6 +5,7 @@ function newCircularMenu () {
let thisObject = {
container: undefined,
isDeployed: undefined,
internalClick: internalClick,
physics: physics,
drawBackground: drawBackground,
drawForeground: drawForeground,
@@ -57,6 +58,12 @@ function newCircularMenu () {
menuItem.workingLabel = menuItemInitialValue.workingLabel
menuItem.workDoneLabel = menuItemInitialValue.workDoneLabel
menuItem.workFailedLabel = menuItemInitialValue.workFailedLabel
menuItem.secondaryAction = menuItemInitialValue.secondaryAction
menuItem.secondaryLabel = menuItemInitialValue.secondaryLabel
menuItem.secondaryWorkingLabel = menuItemInitialValue.secondaryWorkingLabel
menuItem.secondaryWorkDoneLabel = menuItemInitialValue.secondaryWorkDoneLabel
menuItem.secondaryWorkFailedLabel = menuItemInitialValue.secondaryWorkFailedLabel
menuItem.secondaryIcon = menuItemInitialValue.secondaryIcon
menuItem.visible = menuItemInitialValue.visible
menuItem.iconPathOn = menuItemInitialValue.iconPathOn
menuItem.iconPathOff = menuItemInitialValue.iconPathOff
@@ -90,49 +97,66 @@ function newCircularMenu () {
if (thisObject.isDeployed === true) {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
container = menutItem.getContainer(point)
let menuItem = menuItems[i]
if (menuItem.visible === true) {
container = menuItem.getContainer(point)
}
if (container !== undefined) { return container }
}
}
}
function internalClick (action) {
for (let i = 0; i < menuItems.length; i++) {
let menuItem = menuItems[i]
if (menuItem.visible === true) {
if (menuItem.nextAction === action) {
menuItem.internalClick()
}
}
}
}
function physics () {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
menutItem.physics()
let menuItem = menuItems[i]
menuItem.physics()
}
}
function onFocus () {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
menutItem.targetRadius = menutItem.rawRadius * 1.5
menutItem.isDeployed = true
let menuItem = menuItems[i]
menuItem.targetRadius = menuItem.rawRadius * 1.5
menuItem.isDeployed = true
}
thisObject.isDeployed = true
}
function onNotFocus () {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
menutItem.targetRadius = menutItem.rawRadius * 0 - i * 4
menutItem.isDeployed = false
let menuItem = menuItems[i]
menuItem.targetRadius = menuItem.rawRadius * 0 - i * 4
menuItem.isDeployed = false
}
thisObject.isDeployed = false
}
function drawBackground (pFloatingObject) {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
menutItem.drawBackground()
let menuItem = menuItems[i]
if (menuItem.visible === true) {
menuItem.drawBackground()
}
}
}
function drawForeground (pFloatingObject) {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
menutItem.drawForeground()
let menuItem = menuItems[i]
if (menuItem.visible === true) {
menuItem.drawForeground()
}
}
}
}
+134 -32
View File
@@ -17,6 +17,13 @@ function newCircularMenuItem () {
workingLabel: undefined,
workDoneLabel: undefined,
workFailedLabel: undefined,
secondaryAction: undefined,
secondaryLabel: undefined,
secondaryWorkingLabel: undefined,
secondaryWorkDoneLabel: undefined,
secondaryWorkFailedLabel: undefined,
secondaryIcon: undefined,
nextAction: undefined,
visible: false,
iconPathOn: undefined,
iconPathOff: undefined,
@@ -28,6 +35,7 @@ function newCircularMenuItem () {
payload: undefined,
relatedStrategyPart: undefined,
dontShowAtFullscreen: undefined,
internalClick: internalClick,
physics: physics,
drawBackground: drawBackground,
drawForeground: drawForeground,
@@ -57,8 +65,19 @@ function newCircularMenuItem () {
let defaultBackgroudColor = UI_COLOR.RED
let backgroundColorToUse = UI_COLOR.RED
let temporaryStatus = 0
let temporaryStatusCounter = 0
const EXTRA_MOUSE_OVER_ICON_SIZE = 2
const STATUS_NO_ACTION_TAKEN_YET = 0
const STATUS_PRIMARY_ACTION_WORKING = -1
const STATUS_SECONDARY_ACTION_WORKING = -2
const STATUS_PRIMARY_WORK_DONE = -3
const STATUS_PRIMARY_WORK_FAILED = -4
const STATUS_WAITING_CONFIRMATION = -5
const STATUS_SECONDARY_WORK_DONE = -6
const STATUS_SECONDARY_WORK_FAILED = -7
return thisObject
function finalize () {
@@ -90,6 +109,8 @@ function newCircularMenuItem () {
} else {
thisObject.container.frame.width = 50
}
thisObject.nextAction = thisObject.action
}
function getContainer (point) {
@@ -123,25 +144,39 @@ function newCircularMenuItem () {
/* Temporary Status impacts on the label to use and the background of that label */
temporaryStatus--
if (temporaryStatus < 0) {
temporaryStatus = 0
if (temporaryStatusCounter > 0) {
temporaryStatusCounter--
}
if (temporaryStatus === 0) {
if (temporaryStatusCounter === 0) {
temporaryStatus = STATUS_NO_ACTION_TAKEN_YET
labelToPrint = thisObject.label
backgroundColorToUse = defaultBackgroudColor
thisObject.nextAction = thisObject.action
}
iconPhysics()
}
function iconPhysics () {
if (thisObject.relatedStrategyPart !== undefined) {
thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
if (
(
temporaryStatus === STATUS_PRIMARY_WORK_DONE ||
temporaryStatus === STATUS_SECONDARY_ACTION_WORKING ||
temporaryStatus === STATUS_SECONDARY_WORK_DONE ||
temporaryStatus === STATUS_SECONDARY_WORK_FAILED
) && thisObject.secondaryAction !== undefined
) {
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon)
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon)
} else {
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn)
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff)
if (thisObject.relatedStrategyPart !== undefined) {
thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
} else {
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn)
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff)
}
}
/* Current Status might be linked to some other object status */
@@ -171,38 +206,106 @@ function newCircularMenuItem () {
isMouseOver = false
}
async function onMouseClick (event) {
if (temporaryStatus === 0 && thisObject.askConfirmation !== true) {
if (thisObject.workingLabel !== undefined) {
setTemporaryStatus(thisObject.workingLabel, UI_COLOR.GREY, 500)
function internalClick () {
onMouseClick()
}
function onMouseClick () {
if (thisObject.label === undefined) {
/* This is what we have in the case of menu items that are only Icons. In this situation there is no complex logic, just execute the specified action. */
thisObject.actionFunction(thisObject.payload, thisObject.action)
return
}
if (thisObject.askConfirmation !== true) { /* No confirmation is needed */
if (temporaryStatus === STATUS_NO_ACTION_TAKEN_YET || temporaryStatus === STATUS_PRIMARY_WORK_DONE) {
executeAction()
} // Any click out of those states is ignored
} else {
/* Confirmation is needed */
/* The first click ask for confirmation. */
if (temporaryStatus === STATUS_NO_ACTION_TAKEN_YET) {
setStatus(thisObject.confirmationLabel, UI_COLOR.GREY, 250, STATUS_WAITING_CONFIRMATION)
return
}
thisObject.currentStatus = await thisObject.actionFunction(thisObject.payload, thisObject.action)
if (thisObject.currentStatus === true) {
if (thisObject.workDoneLabel !== undefined) {
setTemporaryStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 250)
}
} else {
if (thisObject.workFailedLabel != undefined) {
setTemporaryStatus(thisObject.workFailedLabel, UI_COLOR.TITANIUM_YELLOW, 500)
}
/* A Click during confirmation executes the pre-defined action. */
if (temporaryStatus === STATUS_WAITING_CONFIRMATION || temporaryStatus === STATUS_PRIMARY_WORK_DONE) {
executeAction()
return
}
}
if (temporaryStatus > 0 && thisObject.askConfirmation === true) {
thisObject.currentStatus = await thisObject.actionFunction(thisObject.payload, thisObject.action)
}
function executeAction () {
if (temporaryStatus === STATUS_NO_ACTION_TAKEN_YET || temporaryStatus === STATUS_WAITING_CONFIRMATION) {
/* We need to execute the main Action */
/* If there is a working label defined, we use it here. */
if (thisObject.workingLabel !== undefined) {
setStatus(thisObject.workingLabel, UI_COLOR.GREY, undefined, STATUS_PRIMARY_ACTION_WORKING) // Status will not expire, will only change with a callback. Mouse Clicks will be ignored.
}
if (temporaryStatus === 0 && thisObject.askConfirmation === true) {
setTemporaryStatus(thisObject.confirmationLabel, UI_COLOR.GREY, 50)
/* Execute the action and wait for callbacks to update our statuus. */
thisObject.actionFunction(thisObject.payload, thisObject.action, onPrimaryCallBack)
return
}
if (temporaryStatus === STATUS_PRIMARY_WORK_DONE && thisObject.secondaryAction !== undefined) {
/* We need to execute the secondary action. */
if (thisObject.secondaryWorkingLabel !== undefined) {
setStatus(thisObject.secondaryWorkingLabel, UI_COLOR.GREY, undefined, STATUS_SECONDARY_ACTION_WORKING) // Status will not expire, will only change with a callback. Mouse Clicks will be ignored.
}
/* Execute the action and wait for callbacks to update our statuus. */
thisObject.actionFunction(thisObject.payload, thisObject.secondaryAction, onSecondaryCallBack)
return
}
function onPrimaryCallBack (err) {
/* If there is a secondary action we will act different that if there is not */
if (thisObject.secondaryAction === undefined) { // This means there are no more possible actions.
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
if (thisObject.workDoneLabel !== undefined) {
setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 250, STATUS_PRIMARY_WORK_DONE)
}
} else {
if (thisObject.workFailedLabel != undefined) {
setStatus(thisObject.workFailedLabel, UI_COLOR.TITANIUM_YELLOW, 500, STATUS_PRIMARY_WORK_FAILED)
}
}
} else {
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
if (thisObject.workDoneLabel !== undefined) {
thisObject.nextAction = thisObject.secondaryAction
setStatus(thisObject.secondaryLabel, defaultBackgroudColor, undefined, STATUS_PRIMARY_WORK_DONE)
}
} else {
if (thisObject.workFailedLabel != undefined) {
setStatus(thisObject.workFailedLabel, UI_COLOR.TITANIUM_YELLOW, 500, STATUS_PRIMARY_WORK_FAILED)
}
}
}
}
function onSecondaryCallBack (err) {
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
if (thisObject.secondaryWorkDoneLabel !== undefined) {
setStatus(thisObject.secondaryWorkDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 250, STATUS_SECONDARY_WORK_DONE)
}
} else {
if (thisObject.secondaryWorkFailedLabel != undefined) {
setStatus(thisObject.secondaryWorkFailedLabel, UI_COLOR.TITANIUM_YELLOW, 500, STATUS_SECONDARY_WORK_FAILED)
}
}
}
}
}
function setTemporaryStatus (text, backgroundColor, waitingCycles) {
function setStatus (text, backgroundColor, waitingCycles, newStatus) {
labelToPrint = text
backgroundColorToUse = backgroundColor
temporaryStatus = waitingCycles
temporaryStatus = newStatus
temporaryStatusCounter = newStatus // This will often put this into negatives numbers, which will disable the counting back and automatic reseting.
if (waitingCycles !== undefined) { // This will override the often negative value with a positive one that will tend to zero onto the default state.
temporaryStatusCounter = waitingCycles
}
}
function drawBackground () {
@@ -274,4 +377,3 @@ function newCircularMenuItem () {
}
}
}
+13 -7
View File
@@ -23,11 +23,14 @@ function newCircularProgressBar () {
let opacityCounters = []
let eventSubscriptionHeartbeat
return thisObject
function finalize () {
thisObject.container = undefined
systemEventHandler.stopListening('Jason-Heartbeat-Period', eventSubscriptionHeartbeat)
thisObject.container = undefined
thisObject.payload = undefined
thisObject.fitFunction = undefined
}
@@ -40,8 +43,11 @@ function newCircularProgressBar () {
}
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
systemEventHandler.createEventHandler(key)
systemEventHandler.listenToEvent(key, 'Heartbeat', undefined, key, undefined, onHeartBeat)
systemEventHandler.listenToEvent(key, 'Heartbeat', undefined, key, onResponse, onHeartBeat)
function onResponse (message) {
eventSubscriptionIdHeartbeat = message.eventSubscriptionId
}
}
function onHeartBeat (message) {
@@ -69,6 +75,10 @@ function newCircularProgressBar () {
}
function drawBackground (pFloatingObject) {
}
function drawForeground (pFloatingObject) {
const VISIBLE_RADIUS = thisObject.container.frame.radius * 2
let visiblePosition = {
@@ -100,8 +110,4 @@ function newCircularProgressBar () {
browserCanvasContext.stroke()
}
}
function drawForeground (pFloatingObject) {
}
}
+75 -56
View File
@@ -18,11 +18,11 @@ function newStrategyPart () {
partTitle: undefined,
circularProgressBar: undefined,
isExecuting: undefined,
isRunning: undefined,
isDefault: undefined,
setAsDefault: setAsDefault,
run: run,
play: play,
stop: stop,
setRunningStatus: setRunningStatus,
setDefaultStatus: setDefaultStatus,
setNotRunningStatus: setNotRunningStatus,
getReadyToAttach: getReadyToAttach,
showAvailabilityToAttach: showAvailabilityToAttach,
@@ -170,7 +170,7 @@ function newStrategyPart () {
thisObject.codeEditor.physics()
}
if (thisObject.payload.chainParent === undefined) {
if (thisObject.payload.chainParent === undefined || thisObject.payload.chainParent.payload === undefined) {
thisObject.payload.targetPosition.x = thisObject.payload.position.x,
thisObject.payload.targetPosition.y = thisObject.payload.position.y
} else {
@@ -203,151 +203,151 @@ function newStrategyPart () {
let compatibleSubType
switch (thisObject.payload.node.type) {
case 'Trading System':
compatibleType = '->' + 'Definition'
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Personal Data':
compatibleType = '->' + 'Definition'
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Exchange Account':
compatibleType = '->' + 'Personal Data'
compatibleType = '->' + 'Personal Data' + '->'
compatibleSubType = undefined
break
case 'Exchange Account Asset':
compatibleType = '->' + 'Exchange Account'
compatibleType = '->' + 'Exchange Account' + '->'
compatibleSubType = undefined
break
case 'Exchange Account Key':
compatibleType = '->' + 'Exchange Account'
compatibleType = '->' + 'Exchange Account' + '->'
compatibleSubType = undefined
break
case 'Parameters':
compatibleType = '->' + 'Trading System'
compatibleType = '->' + 'Trading System' + '->'
compatibleSubType = undefined
break
case 'Base Asset':
compatibleType = '->' + 'Parameters'
compatibleType = '->' + 'Parameters' + '->'
compatibleSubType = undefined
break
case 'Time Range':
compatibleType = '->' + 'Parameters'
compatibleType = '->' + 'Parameters' + '->'
compatibleSubType = undefined
break
case 'Slippage':
compatibleType = '->' + 'Parameters'
compatibleType = '->' + 'Parameters' + '->'
compatibleSubType = undefined
break
case 'Fee Structure':
compatibleType = '->' + 'Parameters'
compatibleType = '->' + 'Parameters' + '->'
compatibleSubType = undefined
break
case 'Task Manager':
compatibleType = '->' + 'Definition'
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Task':
compatibleType = '->' + 'Task Manager'
compatibleType = '->' + 'Task Manager' + '->'
compatibleSubType = undefined
break
case 'Sensor':
compatibleType = '->' + 'Task'
compatibleType = '->' + 'Task' + '->'
compatibleSubType = undefined
break
case 'Indicator':
compatibleType = '->' + 'Task'
compatibleType = '->' + 'Task' + '->'
compatibleSubType = undefined
break
case 'Trading Engine':
compatibleType = '->' + 'Task'
compatibleType = '->' + 'Task' + '->'
compatibleSubType = undefined
break
case 'Process':
compatibleType = '->' + 'Sensor' + '->' + 'Indicator' + '->' + 'Trading Engine'
compatibleType = '->' + 'Sensor' + '->' + 'Indicator' + '->' + 'Trading Engine' + '->'
compatibleSubType = undefined
break
case 'Strategy':
compatibleType = '->' + 'Trading System'
compatibleType = '->' + 'Trading System' + '->'
compatibleSubType = undefined
break
case 'Trigger Stage':
compatibleType = '->' + 'Strategy'
compatibleType = '->' + 'Strategy' + '->'
compatibleSubType = undefined
break
case 'Open Stage':
compatibleType = '->' + 'Strategy'
compatibleType = '->' + 'Strategy' + '->'
compatibleSubType = undefined
break
case 'Manage Stage':
compatibleType = '->' + 'Strategy'
compatibleType = '->' + 'Strategy' + '->'
compatibleSubType = undefined
break
case 'Close Stage':
compatibleType = '->' + 'Strategy'
compatibleType = '->' + 'Strategy' + '->'
compatibleSubType = undefined
break
case 'Position Size':
compatibleType = '->' + 'Initial Definition'
compatibleType = '->' + 'Initial Definition' + '->'
compatibleSubType = undefined
break
case 'Position Rate':
compatibleType = '->' + 'Initial Definition'
compatibleType = '->' + 'Initial Definition' + '->'
compatibleSubType = undefined
break
case 'Take Position Event':
compatibleType = '->' + 'Trigger Stage'
compatibleType = '->' + 'Trigger Stage' + '->'
compatibleSubType = undefined
break
case 'Trigger Off Event':
compatibleType = '->' + 'Trigger Stage'
compatibleType = '->' + 'Trigger Stage' + '->'
compatibleSubType = undefined
break
case 'Trigger On Event':
compatibleType = '->' + 'Trigger Stage'
compatibleType = '->' + 'Trigger Stage' + '->'
compatibleSubType = undefined
break
case 'Initial Definition':
compatibleType = '->' + 'Open Stage'
compatibleType = '->' + 'Open Stage' + '->'
compatibleSubType = undefined
break
case 'Open Execution':
compatibleType = '->' + 'Open Stage'
compatibleType = '->' + 'Open Stage' + '->'
compatibleSubType = undefined
break
case 'Close Execution':
compatibleType = '->' + 'Close Stage'
compatibleType = '->' + 'Close Stage' + '->'
compatibleSubType = undefined
break
case 'Stop':
compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition'
compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition' + '->'
compatibleSubType = undefined
break
case 'Take Profit':
compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition'
compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition' + '->'
compatibleSubType = undefined
break
case 'Phase':
compatibleType = '->' + 'Stop' + '->' + 'Take Profit' + '->' + 'Phase'
compatibleType = '->' + 'Stop' + '->' + 'Take Profit' + '->' + 'Phase' + '->'
compatibleSubType = undefined
break
case 'Formula':
compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase'
compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->'
compatibleSubType = undefined
break
case 'Next Phase Event':
compatibleType = '->' + 'Phase'
compatibleType = '->' + 'Phase' + '->'
compatibleSubType = undefined
break
case 'Situation':
compatibleType = '->' + 'Take Position Event' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Next Phase Event'
compatibleType = '->' + 'Take Position Event' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Next Phase Event' + '->'
compatibleSubType = undefined
break
case 'Condition':
compatibleType = '->' + 'Situation'
compatibleType = '->' + 'Situation' + '->'
compatibleSubType = undefined
break
case 'Code':
compatibleType = '->' + 'Condition'
compatibleType = '->' + 'Condition' + '->'
compatibleSubType = undefined
break
default:
@@ -362,9 +362,8 @@ function newStrategyPart () {
let distance = nearby[0]
let floatingObject = nearby[1]
let nearbyNode = floatingObject.payload.node
if (compatibleType.indexOf('->' + nearbyNode.type) >= 0) {
if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) {
/* Discard objects with busy coonection ports */
if (thisObject.payload.node.type === 'Task Manager' && nearbyNode.taskManager !== undefined) { continue }
if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue }
if (thisObject.payload.node.type === 'Sensor' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Indicator' && nearbyNode.bot !== undefined) { continue }
@@ -531,7 +530,8 @@ function newStrategyPart () {
}
}
function play () {
function run (callBackFunction) {
/* We setup the circular progress bar. */
if (thisObject.circularProgressBar !== undefined) {
thisObject.circularProgressBar.finalize()
}
@@ -540,30 +540,49 @@ function newStrategyPart () {
thisObject.circularProgressBar.initialize(thisObject.payload)
thisObject.circularProgressBar.fitFunction = thisObject.fitFunction
thisObject.circularProgressBar.container = thisObject.container
}
function stop () {
setTimeout(removecircularProgressBar, 90000)
function removecircularProgressBar () {
thisObject.circularProgressBar.finalize()
thisObject.circularProgressBar = undefined
/* We will wait to the event that the task was terminated in order to call back the menu item */
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
systemEventHandler.listenToEvent(key, 'Running', undefined, key, undefined, onTaskTerminated)
function onTaskTerminated () {
if (callBackFunction !== undefined) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
}
}
}
function run () {
setRunningStatus()
function stop (callBackFunction) {
/* We will wait to the event that the task was terminated in order to call back the menu item */
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
let eventSubscriptionId = systemEventHandler.listenToEvent(key, 'Stopped', undefined, key, undefined, onTaskTerminated)
function onTaskTerminated () {
if (callBackFunction !== undefined) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
}
if (thisObject.circularProgressBar !== undefined) {
thisObject.circularProgressBar.finalize()
thisObject.circularProgressBar = undefined
}
}
}
function setAsDefault () {
setDefaultStatus()
canvas.cockpitSpace.restartSimulation.restart()
}
function setRunningStatus () {
function setDefaultStatus () {
canvas.strategySpace.workspace.definition = thisObject.payload.node
thisObject.isRunning = true
thisObject.isDefault = true
runningCounter = 30
}
function setNotRunningStatus () {
canvas.strategySpace.workspace.definition = undefined
thisObject.isRunning = false
thisObject.isDefault = false
}
function iconPhysics () {
@@ -940,7 +959,7 @@ function newStrategyPart () {
browserCanvasContext.fill()
if (thisObject.isRunning === true) {
if (thisObject.isDefault === true) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2
let OPACITY = runningCounter / 30
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -125,7 +125,7 @@ function newSplashScreen () {
fontSize = 15
title = 'Trading Bots Competitions Platform'
title = 'Trading Automation System'
titlePoint = {
x: thisObject.container.frame.width / 2 - title.length / 2 * fontSize * FONT_ASPECT_RATIO - 20,
@@ -50,12 +50,24 @@ function newAttachDetach () {
return
}
case 'Task Manager': {
node.payload.parentNode.taskManager = undefined
let payload = node.payload
for (let i = 0; i < payload.parentNode.taskManagers.length; i++) {
let taskManager = payload.parentNode.taskManagers[i]
if (taskManager.id === node.id) {
payload.parentNode.taskManagers.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Task': {
node.payload.parentNode.task = undefined
let payload = node.payload
for (let i = 0; i < payload.parentNode.tasks.length; i++) {
let task = payload.parentNode.tasks[i]
if (task.id === node.id) {
payload.parentNode.tasks.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
@@ -251,7 +263,7 @@ function newAttachDetach () {
case 'Task Manager': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.taskManager = node
node.payload.parentNode.taskManagers.push(node)
completeAttachment(node, rootNodes)
}
break
@@ -145,10 +145,13 @@ function newNodeChildren () {
response.childIndex = response.childrenCount
}
}
if (parentNode.taskManager !== undefined) {
response.childrenCount++
if (parentNode.taskManager.id === childNode.id) {
response.childIndex = response.childrenCount
if (parentNode.taskManagers !== undefined) {
for (let i = 0; i < parentNode.taskManagers.length; i++) {
let child = parentNode.taskManagers[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
@@ -44,149 +44,151 @@ function newNodeDeleter () {
}
function deleteWorkspace (node, rootNodes) {
while (node.rootNodes.length > 0) {
let rootNode = node.rootNodes[0]
switch (rootNode.type) {
if (node.rootNodes !== undefined) {
while (node.rootNodes.length > 0) {
let rootNode = node.rootNodes[0]
switch (rootNode.type) {
case 'Definition': {
deleteDefinition(rootNode, rootNodes, true)
break
}
case 'Task Manager': {
deleteTaskManager(rootNode, rootNodes)
break
}
case 'Task': {
deleteTask(rootNode, rootNodes)
break
}
case 'Sensor': {
deleteBot(rootNode, rootNodes)
break
}
case 'Indicator': {
deleteBot(rootNode, rootNodes)
break
}
case 'Trading Engine': {
deleteBot(rootNode, rootNodes)
break
}
case 'Process': {
deleteProcess(rootNode, rootNodes)
break
}
case 'Personal Data': {
deletePersonalData(rootNode, rootNodes)
break
}
case 'Exchange Account': {
deleteExchangeAccount(rootNode, rootNodes)
break
}
case 'Exchange Account Asset': {
deleteExchangeAccountAsset(rootNode, rootNodes)
break
}
case 'Exchange Account Key': {
deleteExchangeAccountKey(rootNode, rootNodes)
break
}
case 'Trading System': {
deleteTradingSystem(rootNode, rootNodes)
break
}
case 'Parameters': {
deleteParameters(rootNode, rootNodes)
break
}
case 'Base Asset': {
deleteBaseAsset(rootNode, rootNodes)
break
}
case 'Time Range': {
deleteTimeRange(rootNode, rootNodes)
break
}
case 'Slippage': {
deleteSlippage(rootNode, rootNodes)
break
}
case 'Fee Structure': {
deleteFeeStructure(rootNode, rootNodes)
break
}
case 'Strategy': {
deleteStrategy(rootNode, rootNodes)
break
}
case 'Trigger Stage': {
deleteTriggerStage(rootNode, rootNodes)
break
}
case 'Open Stage': {
deleteOpenStage(rootNode, rootNodes)
break
}
case 'Manage Stage': {
deleteManageStage(rootNode, rootNodes)
break
}
case 'Close Stage': {
deleteCloseStage(rootNode, rootNodes)
break
}
case 'Position Size': {
deletePositionSize(rootNode, rootNodes)
break
}
case 'Position Rate': {
deletePositionRate(rootNode, rootNodes)
break
}
case 'Initial Definition': {
deleteInitialDefinition(rootNode, rootNodes)
break
}
case 'Open Execution': {
deleteOpenExecution(rootNode, rootNodes)
break
}
case 'Close Execution': {
deleteCloseExecution(rootNode, rootNodes)
break
}
case 'Event': {
deleteEvent(rootNode, rootNodes)
break
}
case 'Managed Item': {
deleteManagedItem(rootNode, rootNodes)
break
}
case 'Phase': {
deletePhase(rootNode, rootNodes)
break
}
case 'Formula': {
deleteFormula(rootNode, rootNodes)
break
}
case 'Situation': {
deleteSituation(rootNode, rootNodes)
break
}
case 'Condition': {
deleteCondition(rootNode, rootNodes)
break
}
case 'Code': {
deleteCode(rootNode, rootNodes)
break
}
case 'Definition': {
deleteDefinition(rootNode, rootNodes, true)
break
}
case 'Task Manager': {
deleteTaskManager(rootNode, rootNodes)
break
}
case 'Task': {
deleteTask(rootNode, rootNodes)
break
}
case 'Sensor': {
deleteBot(rootNode, rootNodes)
break
}
case 'Indicator': {
deleteBot(rootNode, rootNodes)
break
}
case 'Trading Engine': {
deleteBot(rootNode, rootNodes)
break
}
case 'Process': {
deleteProcess(rootNode, rootNodes)
break
}
case 'Personal Data': {
deletePersonalData(rootNode, rootNodes)
break
}
case 'Exchange Account': {
deleteExchangeAccount(rootNode, rootNodes)
break
}
case 'Exchange Account Asset': {
deleteExchangeAccountAsset(rootNode, rootNodes)
break
}
case 'Exchange Account Key': {
deleteExchangeAccountKey(rootNode, rootNodes)
break
}
case 'Trading System': {
deleteTradingSystem(rootNode, rootNodes)
break
}
case 'Parameters': {
deleteParameters(rootNode, rootNodes)
break
}
case 'Base Asset': {
deleteBaseAsset(rootNode, rootNodes)
break
}
case 'Time Range': {
deleteTimeRange(rootNode, rootNodes)
break
}
case 'Slippage': {
deleteSlippage(rootNode, rootNodes)
break
}
case 'Fee Structure': {
deleteFeeStructure(rootNode, rootNodes)
break
}
case 'Strategy': {
deleteStrategy(rootNode, rootNodes)
break
}
case 'Trigger Stage': {
deleteTriggerStage(rootNode, rootNodes)
break
}
case 'Open Stage': {
deleteOpenStage(rootNode, rootNodes)
break
}
case 'Manage Stage': {
deleteManageStage(rootNode, rootNodes)
break
}
case 'Close Stage': {
deleteCloseStage(rootNode, rootNodes)
break
}
case 'Position Size': {
deletePositionSize(rootNode, rootNodes)
break
}
case 'Position Rate': {
deletePositionRate(rootNode, rootNodes)
break
}
case 'Initial Definition': {
deleteInitialDefinition(rootNode, rootNodes)
break
}
case 'Open Execution': {
deleteOpenExecution(rootNode, rootNodes)
break
}
case 'Close Execution': {
deleteCloseExecution(rootNode, rootNodes)
break
}
case 'Event': {
deleteEvent(rootNode, rootNodes)
break
}
case 'Managed Item': {
deleteManagedItem(rootNode, rootNodes)
break
}
case 'Phase': {
deletePhase(rootNode, rootNodes)
break
}
case 'Formula': {
deleteFormula(rootNode, rootNodes)
break
}
case 'Situation': {
deleteSituation(rootNode, rootNodes)
break
}
case 'Condition': {
deleteCondition(rootNode, rootNodes)
break
}
case 'Code': {
deleteCode(rootNode, rootNodes)
break
}
default: {
console.log('WARNING this node type is not listed at NodeDeleter: ' + node.type)
default: {
console.log('WARNING this node type is not listed at NodeDeleter: ' + node.type)
}
}
}
}
@@ -211,7 +213,7 @@ function newNodeDeleter () {
if (counter <= 1) { return }
}
if (node.payload.uiObject.isRunning === true) {
if (node.payload.uiObject.isDefault === true) {
node.payload.uiObject.setNotRunningStatus()
}
@@ -221,9 +223,12 @@ function newNodeDeleter () {
if (node.personalData !== undefined) {
deletePersonalData(node.personalData, rootNodes)
}
if (node.taskManager !== undefined) {
deleteTaskManager(node.taskManager, rootNodes)
if (node.taskManagers !== undefined) {
while (node.taskManagers.length > 0) {
deleteTaskManager(node.taskManagers[0], rootNodes)
}
}
completeDeletion(node, rootNodes)
destroyPart(node)
cleanNode(node)
@@ -232,10 +237,17 @@ function newNodeDeleter () {
function deleteTaskManager (node, rootNodes) {
let payload = node.payload
if (payload.parentNode !== undefined) {
payload.parentNode.taskManager = undefined
for (let j = 0; j < payload.parentNode.taskManagers.length; j++) {
let taskManager = payload.parentNode.taskManagers[j]
if (taskManager.id === node.id) {
payload.parentNode.taskManagers.splice(j, 1)
}
}
}
while (node.tasks.length > 0) {
deleteTask(node.tasks[0], rootNodes)
if (node.tasks !== undefined) {
while (node.tasks.length > 0) {
deleteTask(node.tasks[0], rootNodes)
}
}
completeDeletion(node, rootNodes)
destroyPart(node)
@@ -265,9 +277,12 @@ function newNodeDeleter () {
if (payload.parentNode !== undefined) {
payload.parentNode.bot = undefined
}
while (node.processes.length > 0) {
deleteProcess(node.processes[0], rootNodes)
if (node.processes !== undefined) {
while (node.processes.length > 0) {
deleteProcess(node.processes[0], rootNodes)
}
}
completeDeletion(node, rootNodes)
destroyPart(node)
cleanNode(node)
@@ -295,8 +310,10 @@ function newNodeDeleter () {
payload.parentNode.personalData = undefined
}
while (node.exchangeAccounts.length > 0) {
deleteExchangeAccount(node.exchangeAccounts[0], rootNodes)
if (node.exchangeAccounts !== undefined) {
while (node.exchangeAccounts.length > 0) {
deleteExchangeAccount(node.exchangeAccounts[0], rootNodes)
}
}
completeDeletion(node, rootNodes)
@@ -314,12 +331,17 @@ function newNodeDeleter () {
}
}
}
while (node.assets.length > 0) {
deleteExchangeAccountAsset(node.assets[0], rootNodes)
if (node.assets !== undefined) {
while (node.assets.length > 0) {
deleteExchangeAccountAsset(node.assets[0], rootNodes)
}
}
while (node.keys.length > 0) {
deleteExchangeAccountKey(node.keys[0], rootNodes)
if (node.keys !== undefined) {
while (node.keys.length > 0) {
deleteExchangeAccountKey(node.keys[0], rootNodes)
}
}
completeDeletion(node, rootNodes)
destroyPart(node)
cleanNode(node)
@@ -364,8 +386,10 @@ function newNodeDeleter () {
payload.parentNode.tradingSystem = undefined
}
while (node.strategies.length > 0) {
deleteStrategy(node.strategies[0], rootNodes)
if (node.strategies !== undefined) {
while (node.strategies.length > 0) {
deleteStrategy(node.strategies[0], rootNodes)
}
}
if (node.parameters !== undefined) {
@@ -640,9 +664,12 @@ function newNodeDeleter () {
completeDeletion(node, rootNodes)
}
while (node.situations.length > 0) {
deleteSituation(node.situations[0], rootNodes)
if (node.situations !== undefined) {
while (node.situations.length > 0) {
deleteSituation(node.situations[0], rootNodes)
}
}
destroyPart(node)
cleanNode(node)
}
@@ -664,9 +691,12 @@ function newNodeDeleter () {
completeDeletion(node, rootNodes)
}
while (node.phases.length > 0) {
deletePhase(node.phases[0])
if (node.phases !== undefined) {
while (node.phases.length > 0) {
deletePhase(node.phases[0])
}
}
destroyPart(node)
cleanNode(node)
}
@@ -718,10 +748,13 @@ function newNodeDeleter () {
for (let j = 0; j < payload.parentNode.situations.length; j++) {
let situation = payload.parentNode.situations[j]
if (situation.id === node.id) {
while (situation.conditions.length > 0) {
let condition = situation.conditions[0]
deleteCondition(condition, rootNodes)
if (situation.conditions !== undefined) {
while (situation.conditions.length > 0) {
let condition = situation.conditions[0]
deleteCondition(condition, rootNodes)
}
}
situation.conditions = []
payload.parentNode.situations.splice(j, 1)
destroyPart(situation)
@@ -730,10 +763,13 @@ function newNodeDeleter () {
}
}
} else {
while (node.conditions.length > 0) {
let condition = node.conditions[0]
deleteCondition(condition)
if (node.conditions !== undefined) {
while (node.conditions.length > 0) {
let condition = node.conditions[0]
deleteCondition(condition)
}
}
node.conditions = []
completeDeletion(node, rootNodes)
destroyPart(node)
@@ -333,8 +333,11 @@ function newPartsFromNodes () {
if (node.personalData !== undefined) {
createPartFromNode(node.personalData, node, node)
}
if (node.taskManager !== undefined) {
createPartFromNode(node.taskManager, node, node)
if (node.taskManagers !== undefined) {
for (let m = 0; m < node.taskManagers.length; m++) {
let taskManager = node.taskManagers[m]
createPartFromNode(taskManager, node, node)
}
}
return
}
@@ -385,14 +388,16 @@ function newPartsFromNodes () {
}
function addTaskManager (node) {
if (node.taskManager === undefined) {
node.taskManager = {
tasks: []
}
createPart('Task Manager', '', node.taskManager, node, node)
let taskManager = {
name: 'New Task Manager'
}
if (node.taskManagers === undefined) {
node.taskManagers = []
}
node.taskManagers.push(taskManager)
createPart('Task Manager', taskManager.name, taskManager, node, node, 'Task Manager')
return node.taskManager
return taskManager
}
function addTask (node) {
@@ -450,7 +450,11 @@ function newProtocolNode () {
name: node.name,
tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseJSONStrings, includeIds),
personalData: getProtocolNode(node.personalData, removePersonalData, parseJSONStrings, includeIds),
taskManager: getProtocolNode(node.taskManager, removePersonalData, parseJSONStrings, includeIds)
taskManagers: []
}
for (let m = 0; m < node.taskManagers.length; m++) {
let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseJSONStrings, includeIds)
object.taskManagers.push(taskManager)
}
return object
}
@@ -435,11 +435,12 @@ function newStringifyNode () {
savedPayload: getSavedPayload(node)
}
for (let m = 0; m < node.tasks.length; m++) {
let task = prepareForStringify(node.tasks[m], removePersonalData)
taskManager.tasks.push(task)
if (node.tasks !== undefined) {
for (let m = 0; m < node.tasks.length; m++) {
let task = prepareForStringify(node.tasks[m], removePersonalData)
taskManager.tasks.push(task)
}
}
return taskManager
}
case 'Task': {
@@ -523,9 +524,15 @@ function newStringifyNode () {
name: node.name,
tradingSystem: prepareForStringify(node.tradingSystem, removePersonalData),
personalData: prepareForStringify(node.personalData, removePersonalData),
taskManager: prepareForStringify(node.taskManager, removePersonalData),
taskManagers: [],
savedPayload: getSavedPayload(node)
}
if (node.taskManagers !== undefined) {
for (let m = 0; m < node.taskManagers.length; m++) {
let taskManager = prepareForStringify(node.taskManagers[m], removePersonalData)
object.taskManagers.push(taskManager)
}
}
return object
}
}
@@ -551,7 +558,7 @@ function newStringifyNode () {
isTensed: (node.payload.floatingObject.isTensed && node.payload.floatingObject.tensedManually)
},
uiObject: {
isRunning: node.payload.uiObject.isRunning
isDefault: node.payload.uiObject.isDefault
}
}
return savedPayload
@@ -8,17 +8,17 @@ function newTaskFunctions () {
return thisObject
function runTask (node, functionLibraryProtocolNode) {
function runTask (node, functionLibraryProtocolNode, callBackFunction) {
/* Check if it is possible to Run or not */
if (node.bot === undefined) { return }
if (node.bot.processes.length === 0) { return }
for (let i = 0; i < node.bot.processes.length; i++) {
let process = node.bot.processes[i]
process.payload.uiObject.play()
process.payload.uiObject.run()
}
node.payload.uiObject.play()
node.payload.uiObject.run(callBackFunction)
let event = {
taskId: node.id,
@@ -28,14 +28,14 @@ function newTaskFunctions () {
systemEventHandler.raiseEvent('Task Manager', 'Run Task', event)
}
function stopTask (node, functionLibraryProtocolNode) {
function stopTask (node, functionLibraryProtocolNode, callBackFunction) {
let event = {
taskId: node.id,
taskName: node.name
}
systemEventHandler.raiseEvent('Task Manager', 'Stop Task', event)
node.payload.uiObject.stop()
node.payload.uiObject.stop(callBackFunction)
if (node.bot === undefined) { return }
if (node.bot.processes.length === 0) { return }
@@ -49,14 +49,18 @@ function newTaskFunctions () {
function runAllTasks (taskManager, functionLibraryProtocolNode) {
for (let i = 0; i < taskManager.tasks.length; i++) {
let node = taskManager.tasks[i]
runTask(node, functionLibraryProtocolNode)
let menu = node.payload.uiObject.menu
menu.internalClick('Run Task')
}
}
function stopAllTasks (taskManager, functionLibraryProtocolNode) {
for (let i = 0; i < taskManager.tasks.length; i++) {
let node = taskManager.tasks[i]
stopTask(node, functionLibraryProtocolNode)
let menu = node.payload.uiObject.menu
menu.internalClick('Stop Task')
}
}
}
+9 -5
View File
@@ -93,7 +93,7 @@ function newWorkspace () {
thisObject.definition = canvas.strategySpace.strategizerGateway.strategizerData
workspaceNode.rootNodes.push(thisObject.definition)
functionLibraryPartsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined)
thisObject.definition.payload.uiObject.setRunningStatus()
thisObject.definition.payload.uiObject.setDefaultStatus()
thisObject.enabled = true
}
}
@@ -167,7 +167,7 @@ function newWorkspace () {
}
}
async function onMenuItemClick (payload, action) {
async function onMenuItemClick (payload, action, callBackFunction) {
switch (action) {
case 'Share Workspace':
{
@@ -186,7 +186,11 @@ function newWorkspace () {
case 'Save Trading System':
{
let result = await canvas.strategySpace.strategizerGateway.saveToStrategyzer(getSimulationParams())
return result
if (result === true) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
} else {
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
}
break
}
@@ -223,12 +227,12 @@ function newWorkspace () {
break
case 'Run Task':
{
functionLibraryTaskFunctions.runTask(payload.node, functionLibraryProtocolNode)
functionLibraryTaskFunctions.runTask(payload.node, functionLibraryProtocolNode, callBackFunction)
}
break
case 'Stop Task':
{
functionLibraryTaskFunctions.stopTask(payload.node, functionLibraryProtocolNode)
functionLibraryTaskFunctions.stopTask(payload.node, functionLibraryProtocolNode, callBackFunction)
}
break
case 'Run All Tasks':
+14 -2
View File
@@ -30,7 +30,13 @@ function newSystemEventHandler () {
function sendCommand (command, responseCallBack, eventsCallBack) {
if (command.action === 'listenToEvent') {
eventListeners.set(command.eventHandlerName + '-' + command.eventType, eventsCallBack)
let key
if (command.callerId !== undefined) {
key = command.eventHandlerName + '-' + command.eventType + '-' + command.callerId
} else {
key = command.eventHandlerName + '-' + command.eventType
}
eventListeners.set(key, eventsCallBack)
}
if (command.callerId && responseCallBack) {
responseWaiters.set(command.callerId, responseCallBack)
@@ -107,7 +113,13 @@ function newSystemEventHandler () {
let message = JSON.parse(e.data)
if (message.action === 'Event Raised') {
let handler = eventListeners.get(message.eventHandlerName + '-' + message.eventType)
let key
if (message.callerId !== undefined) {
key = message.eventHandlerName + '-' + message.eventType + '-' + message.callerId
} else {
key = message.eventHandlerName + '-' + message.eventType
}
let handler = eventListeners.get(key)
if (handler) {
handler(message)
}