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:
parent
5c712f2131
commit
d144d01afe
@ -435,18 +435,14 @@ document.addEventListener(
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
(function animationStartedClosure() {
|
// The offsetParent is not set until the PDF.js iframe or object is visible;
|
||||||
// The offsetParent is not set until the PDF.js iframe or object is visible.
|
// waiting for first animation.
|
||||||
// Waiting for first animation.
|
const animationStarted = new Promise(function (resolve) {
|
||||||
PDFViewerApplication.animationStartedPromise = new Promise(function (
|
window.requestAnimationFrame(resolve);
|
||||||
resolve
|
});
|
||||||
) {
|
|
||||||
window.requestAnimationFrame(resolve);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
|
|
||||||
// We need to delay opening until all HTML is loaded.
|
// We need to delay opening until all HTML is loaded.
|
||||||
PDFViewerApplication.animationStartedPromise.then(function () {
|
animationStarted.then(function () {
|
||||||
PDFViewerApplication.open({
|
PDFViewerApplication.open({
|
||||||
url: DEFAULT_URL,
|
url: DEFAULT_URL,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user