vm: move widget-aware context logic to base vm

This commit is contained in:
jean-emmanuel 2025-03-13 11:49:11 +01:00
parent fba35f1b84
commit e84c1d0435
2 changed files with 15 additions and 14 deletions

View file

@ -16,7 +16,6 @@ class ScriptVm extends Vm {
super()
this.valueOptions = []
this.widget = []
}
@ -33,19 +32,6 @@ class ScriptVm extends Vm {
}
setWidget(widget) {
if (!widget) this.widget.pop()
else this.widget.push(widget)
}
getWidget() {
return this.widget[this.widget.length - 1]
}
resolveId(id) {
var widget = this.getWidget()

View file

@ -6,6 +6,8 @@ class Vm {
constructor() {
this.widget = []
if (!globals) {
var sessionManager
globals = {
@ -58,6 +60,19 @@ class Vm {
}
setWidget(widget) {
if (!widget) this.widget.pop()
else this.widget.push(widget)
}
getWidget() {
return this.widget[this.widget.length - 1]
}
registerGlobals() {
this.sandbox.contentWindow.console = console