[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:
parent
c56f3f04dd
commit
a5aaf62754
@ -1485,6 +1485,10 @@ var PDFWorker = (function PDFWorkerClosure() {
|
||||
return new PDFWorker(null, port);
|
||||
};
|
||||
|
||||
PDFWorker.getWorkerSrc = function() {
|
||||
return getWorkerSrc();
|
||||
};
|
||||
|
||||
return PDFWorker;
|
||||
})();
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user