svgdotjs / svgdom

Straightforward DOM implementation to make SVG.js run headless on Node.js
MIT License
274 stars 54 forks source link

The library is relying on global window/document state #70

Closed Rush closed 4 years ago

Rush commented 4 years ago

Hello, I was considering your library on the server to process/generate some SVG in a dynamic way, unfortunately it looks like your code has this global function registerWindow as shown here https://github.com/svgdotjs/svgdom#get-started-with-svgjs-v3x

Looks like svg.js v2.x (x>5) example is actually more helpful to running on the server

Fuzzyma commented 4 years ago

No, v3 of svg.js is far better off being used on the server-side. What makes you think it isn't? registerWindow is not a global function. It is imported from the svg.js package

// Edit: svg.js needs a window/document to run. That's what svgdom is for. It provides you with a window as you can see in the example you linked