Better DOMContentLoaded handling.
This commit is contained in:
parent
ac2d4abf39
commit
930a28d879
@ -169,15 +169,9 @@ function webViewerLoad() {
|
|||||||
var config = getViewerConfiguration();
|
var config = getViewerConfiguration();
|
||||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||||
require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}});
|
require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}});
|
||||||
require(['pdfjs-web/pdfjs'], function () {
|
require(['pdfjs-web/app', 'pdfjs-web/pdf_print_service'], function (web) {
|
||||||
// Ensure that src/main_loader.js has loaded all the necessary
|
window.PDFViewerApplication = web.PDFViewerApplication;
|
||||||
// dependencies *before* the viewer loads, to prevent issues in browsers
|
web.PDFViewerApplication.run(config);
|
||||||
// relying on e.g. the Promise/URL polyfill in src/shared/util.js (fixes
|
|
||||||
// issue 7448).
|
|
||||||
require(['pdfjs-web/app', 'pdfjs-web/pdf_print_service'], function (web) {
|
|
||||||
window.PDFViewerApplication = web.PDFViewerApplication;
|
|
||||||
web.PDFViewerApplication.run(config);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
|
window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
|
||||||
@ -185,4 +179,9 @@ function webViewerLoad() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', webViewerLoad, true);
|
if (document.readyState === 'interactive' ||
|
||||||
|
document.readyState === 'complete') {
|
||||||
|
webViewerLoad();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', webViewerLoad, true);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user