Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _updateVisibleValue() {
if (!this._focused || !this.showFormulaWhenFocused) {
this.value = this.getBotManager().helper.calculateFormattedBotValue(
this.bot,
this.tag
);
} else {
const val = this.bot.tags[this.tag];
if (isAssignment(val)) {
const assignment: Assignment = val;
this.value = assignment.editing
? assignment.formula
: assignment.value;
} else if (typeof val === 'object') {
this.value = JSON.stringify(val);
} else {
this.value = val;
}
}
}
private _updateAssignment() {
const val = this.bot.tags[this.tag];
if (isAssignment(val)) {
const assignment: Assignment = val;
if (assignment.editing) {
this.getBotManager().helper.updateBot(this.bot, {
tags: {
[this.tag]: assign(assignment, {
editing: false,
}),
},
});
}
}
}
}