Browse Source

Merge pull request #534 from kkujala/master

Fix lint warnings in hello.js.
Andreas Gal 14 years ago
parent
commit
6ae80b5e78
  1. 4
      examples/helloworld/README.md
  2. 11
      examples/helloworld/hello.js

4
examples/helloworld/README.md

@ -1,7 +1,8 @@
## "Hello World" overview ## "Hello World" overview
This example is a minimalistic application of the pdf.js project. The file This example is a minimalistic application of the pdf.js project. The file
`helloworld.pdf` is from the GNUpdf project (see [Introduction to PDF at GNUpdf](http://gnupdf.org/Introduction_to_PDF), and contains a simple and `helloworld.pdf` is from the GNUpdf project (see [Introduction to PDF at
GNUpdf] (http://gnupdf.org/Introduction_to_PDF)), and contains a simple and
human-readable PDF. human-readable PDF.
@ -14,3 +15,4 @@ how to make basic calls to `pdf.js`.
## Additional resources ## Additional resources
+ [GNUpdf - Introduction to PDF](http://gnupdf.org/Introduction_to_PDF) + [GNUpdf - Introduction to PDF](http://gnupdf.org/Introduction_to_PDF)

11
examples/helloworld/hello.js

@ -1,13 +1,17 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
// //
// See README for overview // See README for overview
// //
'use strict';
// //
// Ajax GET request, for binary files // Ajax GET request, for binary files
// (like jQuery's $.get(), but supports the binary type ArrayBuffer) // (like jQuery's $.get(), but supports the binary type ArrayBuffer)
// //
var ajaxGet = function(url, callback){ var ajaxGet = function(url, callback) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', url); xhr.open('GET', url);
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; xhr.mozResponseType = xhr.responseType = 'arraybuffer';
@ -21,12 +25,12 @@ var ajaxGet = function(url, callback){
} }
}; };
xhr.send(null); xhr.send(null);
} };
// //
// This is where the fun happens // This is where the fun happens
// //
ajaxGet('helloworld.pdf', function(data){ ajaxGet('helloworld.pdf', function ajaxGetHelloWorld(data) {
// //
// Instantiate PDFDoc with PDF data // Instantiate PDFDoc with PDF data
// //
@ -47,3 +51,4 @@ ajaxGet('helloworld.pdf', function(data){
// //
page.startRendering(context); page.startRendering(context);
}); });

Loading…
Cancel
Save