draw2d
draw2d copied to clipboard
Using the library with require.
Just saw this : https://github.com/freegroup/draw2d/issues/97#issuecomment-609397867
And wanted to know: A. What is causing this issue? B. Is there a plan to change that in the future?
the reason for that is, that I must create JS Objects from a string like "draw2d.shape.basic.Rectangle" during the loading of a JSON file. For that reason the draw2d must be available i the global space and not inside any protected area like it is if I use require or import.
https://github.com/freegroup/draw2d/blob/master/src/io/json/Reader.js#L146
It would be fine to change this....but I have no idea how to deal with it.
Seems like requiring as draw2d should work though.
besides there should be a better solution than eval. i'll look into it.
EDIT: found a solution using object-resolve-path submitting a pull request
EDIT: https://github.com/freegroup/draw2d/pull/99