I am building a one-page app.
I have some visual features that can be on or off.
A simple way is to ask the user whether they would like to see better effects.
However, is it possible for me to detect it from JavaScript rather than asking them?
For instance:
var iterations = 100000000;
for(var i = 0; i < iterations; i++ ){
// do nothing
};
var time_took = console.timeEnd();
if(time_took < 150) {
// good device
launchEffects();
}
Is this way above reliable? Any good way to achieve this? Just approximate performance check is good, I don't want to import huge 3rd-party library.