+ 1
[SOLVED] Render ES 6 for browsers that support it
Presently many browsers do support most ES 6 features. So instead of transpiling to ES 5 with babel for all browsers, I want to detect if a browser supports a feature. If it does I use the feature else I use the ES 5 alternative. But that is a lot of work for something so trivial. Is there a package or software that helps with that?
6 Antworten
+ 3
Yeah there is search for "feature-detect-es6" on your browsers and see how it works
+ 2
Then use the try and catch to detect eg
try{
var z=()=>{ document.write("Gud");}
z();
document.write("Supported")
}
catch(exception){
document.write("Not Supported")
}
+ 2
Yeah its pure javascript no npm package needed
+ 1
boolean Thanks. That is exactly what I wanted.
0
boolean So no npm package for that?
0
boolean You don't understand me. My question is whether there is an npm package that helps with that. I know I can manually do it but for a large script it is a lot of work.