Improvement on asyc calls
This commit is contained in:
1 parent
8f478c5ca3
commit
92bad2738b
3 files changed
+14
-15
No files matched your search
@@ -133,19 +133,21 @@ function newCircularMenuItem () {
|
||||
|
||||
async function onMouseClick (event) {
|
||||
if (temporaryStatus === 0) {
|
||||
setTemporaryStatus('Saving...', UI_COLOR.GREY)
|
||||
await thisObject.actionFunction(thisObject.payload, thisObject.action).then(result => {
|
||||
setTemporaryStatus('Saved', UI_COLOR.PATINATED_TURQUOISE)
|
||||
}, err => {
|
||||
setTemporaryStatus('Not Saved', UI_COLOR.TITANIUM_YELLOW)
|
||||
})
|
||||
setTemporaryStatus('Saving...', UI_COLOR.GREY, 500)
|
||||
let result = await thisObject.actionFunction(thisObject.payload, thisObject.action)
|
||||
|
||||
if (result === true) {
|
||||
setTemporaryStatus('Saved', UI_COLOR.PATINATED_TURQUOISE, 250)
|
||||
} else {
|
||||
setTemporaryStatus('Not Saved', UI_COLOR.TITANIUM_YELLOW, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setTemporaryStatus (text, backgroundColor) {
|
||||
function setTemporaryStatus (text, backgroundColor, waitingCycles) {
|
||||
labelToPrint = text
|
||||
backgroundColorToUse = backgroundColor
|
||||
temporaryStatus = 500
|
||||
temporaryStatus = waitingCycles
|
||||
}
|
||||
|
||||
function drawBackground () {
|
||||
@@ -202,4 +204,3 @@ function newCircularMenuItem () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ function newTradingSystem () {
|
||||
switch (action) {
|
||||
case 'Save Trading System':
|
||||
{
|
||||
await canvas.strategySpace.workplace.saveToStrategyzer()
|
||||
|
||||
let result = await canvas.strategySpace.workplace.saveToStrategyzer()
|
||||
return result
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -97,11 +97,9 @@ function newWorkspace () {
|
||||
})
|
||||
}
|
||||
|
||||
let fetchDataPromises = []
|
||||
let result = await updateStrategies()
|
||||
|
||||
fetchDataPromises.push(updateStrategies())
|
||||
|
||||
await Promise.all(fetchDataPromises)
|
||||
return result
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] saveToStrategyzer -> err = ' + err.stack) }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user