javascript - PhantomJS can't use PDFJS -
i writing angular-app, uses mozilla's library pdfjs. unfortunately, when executing unit-tests of application, seems phantomjs can't find parts of pdfjs-lib.
here error message:
phantomjs 1.9.8 (linux 0.0.0) error typeerror: 'undefined' not function (near '...}.bind(this), rejection_ti...') @ /home/[...]/bower_components/pdfjs-dist/build/pdf.js:1222
i need use phantomjs because of ci infrastructure.
your problem seems come 'bind' function.
if remember correctly, phantomjs < 2.0 doesn't support bind natively, hence 'undefined not function' message. can use polyfill overcome problem, see:
issue on github: https://github.com/ariya/phantomjs/issues/10522
polyfill on npm : https://www.npmjs.com/package/phantomjs-polyfill
if don't want use npm, there polyfill available mdn: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/function/bind#polyfill
it seems phantomjs 2.* handles correctly, haven't tried.
Comments
Post a Comment