MyScriptJS icon indicating copy to clipboard operation
MyScriptJS copied to clipboard

XMLHttpRequest is undefined using MyScript in a node application

Open gruckion opened this issue 6 years ago • 2 comments
trafficstars

When attempting to import "myscript"; to use in a REST API the XMLHttpRequest instance in undefined.

Assumption was made:

// We are writing some browser module here so the no import found should be ignored
// eslint-disable-next-line no-undef
var request = new XMLHttpRequest();

In order to fix this the dependencies needs to be introduced.

var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;

gruckion avatar Jun 09 '19 13:06 gruckion

Dear Gruckion,

Thank you for contacting us and pointing this.

We will check this internally, and see if we update the samples accordingly.

Best regards,

Olivier

MyScriptSupport avatar Jun 11 '19 08:06 MyScriptSupport

Dear Gruckion,

currently, our library is to be used on browser side only, not on server side. On server side with Node, you shall directly use the REST API.

Best regards,

Olivier

MyScriptSupport avatar Jun 11 '19 15:06 MyScriptSupport