From 95dd9ee185d52f543598cf1b731834ec74ff0626 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 6 Jan 2015 17:50:49 +0100 Subject: [PATCH] Move the |pagerendered| event to pdf_page_view.js Also deprecates the |pagerender| event, except for GENERIC builds. --- web/pdf_page_view.js | 14 +++++++++++--- web/pdf_viewer.js | 5 ----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index cb0725a3c..047b2021c 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -413,12 +413,20 @@ var PDFPageView = (function PDFPageViewClosure() { if (self.onAfterDraw) { self.onAfterDraw(); } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagerender', true, true, { - pageNumber: pdfPage.pageNumber + event.initCustomEvent('pagerendered', true, true, { + pageNumber: self.id }); div.dispatchEvent(event); +//#if GENERIC + // This custom event is deprecated, and will be removed in the future, + // please use the |pagerendered| event instead. + var deprecatedEvent = document.createEvent('CustomEvent'); + deprecatedEvent.initCustomEvent('pagerender', true, true, { + pageNumber: pdfPage.pageNumber + }); + div.dispatchEvent(deprecatedEvent); +//#endif if (!error) { resolveRenderPromise(undefined); diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index e68130ce5..6e2acd33b 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -244,11 +244,6 @@ var PDFViewer = (function pdfViewer() { isOnePageRenderedResolved = true; resolveOnePageRendered(); } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagerendered', true, true, { - pageNumber: pageView.id - }); - self.container.dispatchEvent(event); }; };