Merge pull request #16295 from Pascal-D/updateDeprecatedCustomEvents

Use CustomEvent when dispatching the "webviewerloaded" event
This commit is contained in:
Jonas Jenwald 2023-04-16 16:47:20 +02:00 committed by GitHub
commit 1503701d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,9 +179,12 @@ function webViewerLoad() {
// Give custom implementations of the default viewer a simpler way to
// set various `AppOptions`, by dispatching an event once all viewer
// files are loaded but *before* the viewer initialization has run.
const event = document.createEvent("CustomEvent");
event.initCustomEvent("webviewerloaded", true, true, {
source: window,
const event = new CustomEvent("webviewerloaded", {
bubbles: true,
cancelable: true,
detail: {
source: window,
},
});
try {
// Attempt to dispatch the event at the embedding `document`,