scripting: onCreate: expose value and call onCreate after default value is applied

This commit is contained in:
jean-emmanuel 2022-11-29 08:57:38 +01:00
parent 6ef1d412f9
commit 5230eb2d4b
6 changed files with 14 additions and 4 deletions

View file

@ -232,7 +232,7 @@ class Widget extends EventEmitter {
widget: this,
property: 'onCreate',
code: this.getProp('onCreate'),
context: {}
context: {value: 0}
})
}
@ -337,7 +337,7 @@ class Widget extends EventEmitter {
index: index
})
if (this.scripts.onCreate) this.scripts.onCreate.run({}, {sync: true, send: true, onCreate: true})
if (this.scripts.onCreate) this.scripts.onCreate.run({value: this.value}, {sync: true, send: true, onCreate: true})
}