-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial XHR polyfull for Node.js #6463
Conversation
1. Add `FeatureDetection.isNodeJs` 2. Improve getAbsoluteUri under node. 3. Some additional clean up for Node-specific Resource path.
@mramato, thanks for the pull request! Maintainers, we have a signed CLA from @mramato, so you can review this at any time. I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
CC @jimmyangel this will be in the May 1st release. |
var isNodeJsResult; | ||
function isNodeJs() { | ||
if (!defined(isNodeJsResult)) { | ||
isNodeJsResult = typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]'; // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the eslint-disable-line
for? Can we do eslint-disable-line some-eslint-rule
instead of disabling everything for this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind I guess haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process
is only a global in node and this is browser code so we need to ignore it. I couldn't figure out how to just allow a global for one line.
@mramato are you going to add @jimmyangel to |
Thanks for the offer, but we actually don't have any Node unit tests at this time, so there's no where for you to put them. We want to have them eventually, but the plan is to figure out how to leverage our existing tests in node rather than have a separate set of node-specific tests. |
Sorry, I thought he was already in there but didn't check, I'll add him |
Ok. FYI, I have created a package that uses sampleTerrain in node as a utility (and library) to add elevation to arbitrary GeoJSON data. It includes a few Jasmine tests that end up exercising the XHR functionality here. You could potential reuse, or simply add a command line invocation with a couple of test files. Just let me know if I can help. |
Hi @mramato, It looks like the ability to use xhr from node.js broke in Cesium at some point :(. I tried to use Cesium.sampleTerrain from node.js, and I am seeing this:
Looks like I propose replacing line 1905
with
Does that work for you? Thank you, Ricardo |
@jimmyangel Can you please write up a fresh issue for us to take a look at this. Thanks. |
This is a continuation of #6454 with some minor cleanup and additions.