Jonas Jenwald
74e00ed93c
Change isNodeJS
from a function to a constant
...
Given that this shouldn't change after the `pdf.js`/`pdf.worker.js` files have been loaded, it doesn't seems necessary to keep this as a function.
2019-11-10 16:44:29 +01:00
Jonas Jenwald
2817121bc1
Convert globalScope
and isNodeJS
to proper modules
...
Slightly unrelated to the rest of the patch, but this also removes an out-of-place `globals` definition from the `web/viewer.js` file.
2019-11-10 16:44:29 +01:00
wuhao.daraw
1472c10bab
fix: electron enviroment detection
2019-03-26 20:52:49 +08:00
Romain Petit
13b0ca6b2a
Don't detect nw.js as node.js
...
nw.js is chrome plus nodejs.
It will succeed everywhere chrome succeeds, but fail in many cases where nodejs succeeds (see issue 9071).
So it's safer to consider it as a browser context rather than a nodejs context.
Make travis happy again
CS
Readability + Explanation
The relevant portion of the NW.js documentation:
http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
Added full link to relevant doc.
2018-11-07 11:14:22 +01:00
Jonas Jenwald
0e1b5589e7
Restore the btoa
/atob
polyfills for Node.js
...
These were removed in PR 9170, since they were unused in the browsers that we'll support in PDF.js version `2.0`.
However looking at the output of Travis, where a subset of the unit-tests are run using Node.js, there's warnings about `btoa` being undefined. This doesn't appear to cause any errors, which probably explains why we didn't notice this before (despite PR 9201).
2018-01-13 01:31:05 +01:00