Add first API change, not working yet

This commit is contained in:
asraniel 2012-05-06 21:24:42 +02:00
parent e9128e2e35
commit 353a43cb46

View File

@ -8,10 +8,10 @@
* e.g. No cross domain requests without CORS. * e.g. No cross domain requests without CORS.
* *
* @param {string|TypedAray} source Either a url to a PDF is located or a * @param {string|TypedAray} source Either a url to a PDF is located or a
* typed array already populated with data. * typed array (Uint8Array) already populated with data.
* @return {Promise} A promise that is resolved with {PDFDocumentProxy} object. * @return {Promise} A promise that is resolved with {PDFDocumentProxy} object.
*/ */
PDFJS.getDocument = function getDocument(source) { PDFJS.getDocument = function getDocument(source, headers) {
var promise = new PDFJS.Promise(); var promise = new PDFJS.Promise();
var transport = new WorkerTransport(promise); var transport = new WorkerTransport(promise);
if (typeof source === 'string') { if (typeof source === 'string') {
@ -29,7 +29,8 @@ PDFJS.getDocument = function getDocument(source) {
error: function getPDFError(e) { error: function getPDFError(e) {
promise.reject('Unexpected server response of ' + promise.reject('Unexpected server response of ' +
e.target.status + '.'); e.target.status + '.');
} },
headers: headers
}, },
function getPDFLoad(data) { function getPDFLoad(data) {
transport.sendData(data); transport.sendData(data);