graphlib icon indicating copy to clipboard operation
graphlib copied to clipboard

Migrate to ES6

Open dionyziz opened this issue 6 years ago • 2 comments

ECMAScript 6 provides features that can make the implementation more readable and maintainable. Let's consider migrating to it. I would especially prefer to see the use of classes to make the code simpler.

On the other hand this is not compatible with IE11. However, ES6 works well in Edge, Firefox, Chrome, Safari, and node 6.5 and above. It also works on mobile browsers. Backwards compatibility can potentially be achieved with polyfills, which websites needing old browser support will have to likely use anyway.

What is are the compatibility requirements for this library and do you think such a migration is warranted? If so, we can start by replacing prototype with class.

dionyziz avatar Aug 25 '18 14:08 dionyziz

IE11 is a target of my project which uses dagre.

ES5 seems like a more reasonable target, or use ES6 for the source but distribute transpiled to ES5

mwaldstein avatar Aug 26 '18 16:08 mwaldstein

Agree. While it would be really nice, it is probably still too early for ES6. Using a compiler would be an option. Either change would require a bunch of work, tools keep evolving and currently not seeing anybody that can commit the time to maintain those dependencies.

lutzroeder avatar Aug 26 '18 20:08 lutzroeder

I'm working on modernizing the library.

rustedgrail avatar Mar 03 '23 10:03 rustedgrail