silvermine / videojs-chromecast

MIT License
148 stars 75 forks source link

refactor: use es6 classes #92

Closed andreasgangso closed 2 years ago

andreasgangso commented 3 years ago

Adds babel and uses es6 classes instead of "class.extend"

kontrollanten commented 3 years ago

Is babel really needed? All the latest browsers supports class extends.

@jthomerson Can this be merged if the conflicts are solved?

jthomerson commented 3 years ago

@yokuze whether we need Babel or not is a question for you.

andreasgangso commented 3 years ago

Even if babel doesn't add much value in this specific case, it makes development easier when you can use new features without having to think too much about browser support

yokuze commented 2 years ago

Thank you for the contribution @andreasgan. Closing this since https://github.com/silvermine/videojs-chromecast/pull/98/ is basically identical and was more recently active.

FWIW, I agree that Babel is necessary. While the ES6 class keyword has good browser support, ES2022 static properties and methods (which this PR uses) are not supported in iOS < 14.5, which includes versions of iOS that we target: https://caniuse.com/?search=static%20class

Without Babel, it's easy to let new syntax and built-in methods slip in without knowing that they are incompatible with targeted environments. Babel's transpilation and automatic polyfilling reduces the overhead for contributors and maintainers who would otherwise have to consult the browser support matrix for each non-ES6 syntax and built-in method that they intend to use.