opensourceBIM / BIMserver-JavaScript-API

BIMserver JavaScript API
GNU Lesser General Public License v3.0
55 stars 35 forks source link

Module cannot be used in Node.js #7

Closed marcgille closed 6 years ago

marcgille commented 7 years ago

The use of the window variable is not compatible with use in Node.js, e.g. complains

`/Users/marcgille/git/BIMsurfer/node_modules/bimserverapi/js/bimserverclient.js:20 if (typeof window.BimServerApiWebSocket == "undefined") { ^

ReferenceError: window is not defined `

I would happy to help tweak the code towards state where it can be loaded into Node.js and also as a (browserified) browser version.

Let me know whether you are interested.

marcgille commented 7 years ago

Actually had a first go on 'nodeifying' the code and a tiny mocha-based testsuite running. Would take a bit more to create a pull request. Next step on my side ist adding a browserified sample build to validate that everything still works on the browser side.

Sweet spots are obviously the request (xhdr) and websocket side.

But managable.

rubendel commented 6 years ago

Codebase has been converted to ES6, so I think this can be closed