[Pkg-javascript-commits] [pdf.js] 150/204: Introduces 'pagesinit' event.

David Prévot taffit at moszumanska.debian.org
Sat Oct 25 18:50:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 5740b9602066bb628ad99e862f17cd4d582861bb
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Tue Sep 30 12:31:58 2014 -0500

    Introduces 'pagesinit' event.
---
 examples/components/simpleviewer.js | 8 +++++++-
 web/pdf_viewer.js                   | 6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/examples/components/simpleviewer.js b/examples/components/simpleviewer.js
index 5488817..1934a5a 100644
--- a/examples/components/simpleviewer.js
+++ b/examples/components/simpleviewer.js
@@ -32,8 +32,14 @@ if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
 
 var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf';
 
+var container = document.getElementById('viewerContainer');
 var pdfViewer = new PDFJS.PDFViewer({
-  container: document.getElementById('viewerContainer')
+  container: container
+});
+
+container.addEventListener('pagesinit', function () {
+  // we can use pdfViewer now, e.g. let's change default scale.
+  pdfViewer.currentScaleValue = 'page-width';
 });
 
 // Loading document.
diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js
index f5dd910..02304d0 100644
--- a/web/pdf_viewer.js
+++ b/web/pdf_viewer.js
@@ -270,8 +270,12 @@ var PDFViewer = (function pdfViewer() {
           }
         });
 
+        var event = document.createEvent('CustomEvent');
+        event.initCustomEvent('pagesinit', true, true, null);
+        self.container.dispatchEvent(event);
+
         if (this.defaultRenderingQueue) {
-          firstPagePromise.then(this.update.bind(this));
+          this.update();
         }
       }.bind(this));
     },

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list