mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Use CustomEvent
when dispatching the "webviewerloaded" event
According to MDN, see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent, using initCustomEvent() is deprecated.
This commit is contained in:
parent
342dc760da
commit
d9bf571f5c
1 changed files with 6 additions and 3 deletions
|
@ -179,9 +179,12 @@ function webViewerLoad() {
|
||||||
// Give custom implementations of the default viewer a simpler way to
|
// Give custom implementations of the default viewer a simpler way to
|
||||||
// set various `AppOptions`, by dispatching an event once all viewer
|
// set various `AppOptions`, by dispatching an event once all viewer
|
||||||
// files are loaded but *before* the viewer initialization has run.
|
// files are loaded but *before* the viewer initialization has run.
|
||||||
const event = document.createEvent("CustomEvent");
|
const event = new CustomEvent("webviewerloaded", {
|
||||||
event.initCustomEvent("webviewerloaded", true, true, {
|
bubbles: true,
|
||||||
source: window,
|
cancelable: true,
|
||||||
|
detail: {
|
||||||
|
source: window,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
// Attempt to dispatch the event at the embedding `document`,
|
// Attempt to dispatch the event at the embedding `document`,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue