JS -- Actions must be evaluated in global scope

* All the public properties of doc are injected into globalThis, in order to make them available through `this`
 * Put event in the global scope too.
This commit is contained in:
Calixte Denizet 2020-12-16 14:04:22 +01:00
parent c366390f6b
commit 167ff1a7fc
7 changed files with 178 additions and 53 deletions

View file

@ -70,7 +70,7 @@ class EventDispatcher {
const name = baseEvent.name.replace(" ", "");
const source = this._objects[id];
const event = (this._document.obj._event = new Event(baseEvent));
globalThis.event = new Event(baseEvent);
let savedChange;
if (source.obj._isButton()) {
@ -155,7 +155,7 @@ class EventDispatcher {
}
const first = this._calculationOrder[0];
const source = this._objects[first];
const event = (this._document.obj._event = new Event({}));
globalThis.event = new Event({});
this.runCalculate(source, event);
}