]> git.parisson.com Git - pdf.js.git/commitdiff
Merge branch 'api' of git://github.com/mozilla/pdf.js.git into api
authorYury Delendik <ydelendik@mozilla.com>
Sat, 14 Apr 2012 20:56:57 +0000 (13:56 -0700)
committerYury Delendik <ydelendik@mozilla.com>
Sat, 14 Apr 2012 20:56:57 +0000 (13:56 -0700)
1  2 
src/api.js

diff --cc src/api.js
index 479134bd23cf37054bb3374b04b2d4451b80bc91,74c58a61d733033ed4ba3cb2dd58fac6b35e6ee3..996dd1b42d7e71c9399757e926f421883454d15d
@@@ -101,16 -173,28 +173,31 @@@ var PDFPageProxy = (function PDFPagePro
          rotate = this.rotate;
        return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0);
      },
+     /**
+      * @return {Promise} A promise that is resolved with an {array} of the
+      * annotation objects.
+      */
      getAnnotations: function() {
 +      if (this.annotationsPromise)
 +        return this.annotationsPromise;
 +
        var promise = new PDFJS.Promise();
 -      var annotations = this.pageInfo.annotations;
 -      promise.resolve(annotations);
 +      this.annotationsPromise = promise;
 +      this.transport.getAnnotations(this.pageInfo.pageIndex);
        return promise;
      },
-     render: function(renderContext) {
+     /**
+      * Begins the process of rendering a page to the desired context.
+      * @param {object} params A parameter object that supports:
+      * {
+      *   canvasContext(required): A 2D context of a DOM Canvas object.,
+      *   textLayer(optional): An object that has beginLayout, endLayout, and
+      *                        appendText functions.
+      * }
+      * @return {Promise} A promise that is resolved when the page finishes
+      * rendering.
+      */
+     render: function(params) {
        var promise = new Promise();
        var stats = this.stats;
        stats.time('Overall');