Skip to content

Commit

Permalink
Whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
oxixes committed Jan 12, 2024
1 parent f46fca1 commit 33d21a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions src/wirecloud/platform/static/js/wirecloud/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,31 @@
// If this is a v2 or later widget, we need to instantiate it's entrypoint class
_unloadScripts.call(this);
_loadScripts.call(this).then(() => {
const entrypoint = eval("window[\"" + this.meta.entrypoint + "\"]");
const entrypoint = window[this.meta.entrypoint];
if (entrypoint === undefined) {
this.logManager.log("Widget entrypoint class not found!", {console: false});
} else {
this.widgetClass = Wirecloud.createAPIComponent("widget", this.meta.requirements, entrypoint,
this.wrapperElement.shadowRoot, this.id,
('workspaceview' in this.tab.workspace.view) ? this.tab.workspace.view.workspaceview : undefined);
}

privates.get(this).status = STATUS.RUNNING;

this.dispatchEvent('load');

this.pending_events.forEach(send_pending_event, this);
this.pending_events = [];
});
} else {
privates.get(this).status = STATUS.RUNNING;

this.dispatchEvent('load');

this.pending_events.forEach(send_pending_event, this);
this.pending_events = [];
}

privates.get(this).status = STATUS.RUNNING;
if (this.meta.macversion > 1) {
this.wrapperElement.addEventListener('unload', on_unload.bind(this), true);
} else {
Expand All @@ -340,11 +353,6 @@
level: Wirecloud.constants.LOGGING.INFO_MSG
});
}

this.dispatchEvent('load');

this.pending_events.forEach(send_pending_event, this);
this.pending_events = [];
};

const on_unload = function on_unload() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
this.wrapperElement.contentDocument.defaultView.addEventListener('unload', on_unload.bind(this), true);
} else if (!this.meta.missing && this.meta.macversion > 1) {
// If this is a v2 or later operator, we need to instantiate it's entrypoint class
const entrypoint = eval("window[\"" + this.meta.entrypoint + "\"]");
const entrypoint = window[this.meta.entrypoint];
if (entrypoint === undefined) {
this.logManager.log("Operator entrypoint class not found!", {console: false});
} else {
Expand Down

0 comments on commit 33d21a8

Please sign in to comment.