Simplify the animationStarted handling in the mobile-viewer/ example

(This is something that I happened to notice while working on the previous patch.)

The code in the `examples/mobile-viewer/viewer.js` file is essentially copied from an older version of the default viewer, hence we can slightly simplify the `animationStarted` handling here.
This commit is contained in:
Jonas Jenwald 2021-03-12 17:19:58 +01:00
parent 5c712f2131
commit d144d01afe

View File

@ -435,18 +435,14 @@ document.addEventListener(
true
);
(function animationStartedClosure() {
// The offsetParent is not set until the PDF.js iframe or object is visible.
// Waiting for first animation.
PDFViewerApplication.animationStartedPromise = new Promise(function (
resolve
) {
window.requestAnimationFrame(resolve);
});
})();
// The offsetParent is not set until the PDF.js iframe or object is visible;
// waiting for first animation.
const animationStarted = new Promise(function (resolve) {
window.requestAnimationFrame(resolve);
});
// We need to delay opening until all HTML is loaded.
PDFViewerApplication.animationStartedPromise.then(function () {
animationStarted.then(function () {
PDFViewerApplication.open({
url: DEFAULT_URL,
});