freegroup / draw2d

Create Visio like drawings, diagrams or workflows with JavaScript and HTML5
https://freegroup.github.io/draw2d/#/examples
MIT License
734 stars 226 forks source link

Make implicit dependencies in lib/*.exec.js explicit. #227

Open Kreijstal opened 1 year ago

Kreijstal commented 1 year ago

I seen there has been 3 years of updates here in the git repo but not on npm... why?

There are implicit dependencies on the /lib/ directory the '.exec.js' convert them into CJS or ES6 so that they can be used as modules inside the code, that is jQuery, Raphael, Class, and import/require them everytime they're used. Makes code clearer, easier to read, and more modular.

freegroup commented 1 year ago

The reasons for not publishing to npm are just missing skill and time. I'm using draw2d for https://electra.academy and I need the feature to have draw2d in the global scope. This is not possible if I build up an npm package....or at least I'm not able to do this.

If I include it like this, 'const draw2d = required("draw2d");`, draw2d isn't globally available, which I need. In this case, there is no benefit for me to build an npm package.

Kreijstal commented 1 year ago

couldn't you just do window.draw2d=await import('draw2d');?

freegroup commented 1 year ago

I have tested this in the past, which unfortunately does not work. I do not know why, but other components do not see "draw2d" after using this.