fixme-lausanne / mpdwsgi-web

Awesome web interface for your so loved mpd-wsgi server
http://mpd.fixme.ch
MIT License
6 stars 0 forks source link

Gracefull degradation for old JS engines #10

Open crazygolem opened 9 years ago

crazygolem commented 9 years ago

Unsupported browsers should display something along the line of "your browser is not supported because feature X is not available" when the UI cannot load correctly, instead of keeping the "Welcome! Please, take a seat..." message.

E.g. the interface won't work in Internet Explorer 11 on Windows 8.1, because it does not handle generator functions and the parser throws (SCRIPT1005: '(' attendu).

For some ES6 features, the code can be transpiled as a graceful degradation, even using an ad-hoc JS transpiler loaded by the webpage itself, but other features cannot be backported.

Generators can be rewritten to a certain extent to function with pre-ES6 engines (pun intended) (see https://github.com/lpaimen/YieldifyJS), but I am not sure that it can be generalized to all cases.

If we choose to only support the latest, cutting-edge browsers (IE11 is probably not in that category, even if it can still be considered recent), at least don't let the UI give up everything on unsupported browsers and let the user know that it won't work.

crazygolem commented 9 years ago

Idea: use an error / onerror event handler for script tags that load external JS resources. MDN resource

gcmalloc commented 9 years ago

yeah, I would be in favor of testing for the list of feature we expect the browser to have. I don't really expect IE to work anyway.

BinaryBrain commented 9 years ago

If you write some ES6, why don't you use something like Babylon.js?

dgellow commented 9 years ago

@BinaryBrain I think you meant babel.js. I'm already using it.

See the package.json: https://github.com/fixme-lausanne/mpdwsgi-web/blob/master/package.json#L53

dgellow commented 9 years ago

@Crazygolem I have no interest in supporting IE or safari (they don't support generators), if you want to work on it I think you could try with the Regenator runtime.

Like always, we accept Pull Request.

crazygolem commented 9 years ago

Could you then provide a list of what you intend to support, e.g. in the readme?

Could you describe here briefly what you use babel.js for? (I'm new to this) Does it have something to do with your use of React?

For the record, I know that you accept pull requests. Opening bug reports does not mean that I request YOU to do something, merely that something can be done (possibly by me). Also it allows to discuss the bugs, and possibly give a no-go if something should not be put in there (support of IE6, rewrite in flash to support system clipboard, etc.)

BinaryBrain commented 9 years ago

Oh! Yes of course, sorry. Le 19 août 2015 14:50, "Samuel El-Borai" notifications@github.com a écrit :

@BinaryBrain https://github.com/BinaryBrain I think you meant babel.js http://babeljs.io/. I'm already using it.

See the package.json: https://github.com/fixme-lausanne/mpdwsgi-web/blob/master/package.json#L53

— Reply to this email directly or view it on GitHub https://github.com/fixme-lausanne/mpdwsgi-web/issues/10#issuecomment-132579655 .

dgellow commented 9 years ago

Could you describe here briefly what you use babel.js for? (I'm new to this) Does it have something to do with your use of React?

@Crazygolem babel.js is a compiler (also called transpiler by some people) from ES6/ES7 to ES5. It is used via babelify, a transformer plugin for browserify.