[api-minor] Add a (static) PDFWorker.getWorkerSrc method that returns the current workerSrc

This method returns the currently used `workerSrc`, which thus allows obtaining the fallback `workerSrc` value (e.g. when the option wasn't set by the user).
This commit is contained in:
Jonas Jenwald 2018-01-29 15:58:40 +01:00
parent c56f3f04dd
commit a5aaf62754
2 changed files with 10 additions and 1 deletions

View File

@ -1485,6 +1485,10 @@ var PDFWorker = (function PDFWorkerClosure() {
return new PDFWorker(null, port);
};
PDFWorker.getWorkerSrc = function() {
return getWorkerSrc();
};
return PDFWorker;
})();

View File

@ -24,7 +24,7 @@ import {
DOMCanvasFactory, RenderingCancelledException
} from '../../src/display/dom_utils';
import {
getDocument, PDFDocumentProxy, PDFPageProxy
getDocument, PDFDocumentProxy, PDFPageProxy, PDFWorker
} from '../../src/display/api';
import isNodeJS from '../../src/shared/is_node';
import { PDFJS } from '../../src/display/global';
@ -405,6 +405,11 @@ describe('api', function() {
done.fail(reason);
});
});
it('gets current workerSrc', function() {
let workerSrc = PDFWorker.getWorkerSrc();
expect(typeof workerSrc).toEqual('string');
expect(workerSrc).toEqual(PDFJS.workerSrc);
});
});
describe('PDFDocument', function() {
var loadingTask;