[Koha-devel] ES6 usage in the staff client

Jesse pianohacker at gmail.com
Fri Aug 4 01:23:31 CEST 2017


As part of my work with Preact (and previous work with React), I've been
unsure what to do about these libraries' enthusiasm for ES6.

If you're not familiar, ES6 (or ES2015) is a recent, major update to the
JavaScript standard, and brings in a number of improvements to the
language. Many of these make small parts of JS development a bit more
pleasant, but the most relevant addition is native class support.

These built-in classes have been embraced by a lot of modern JS libraries,
including Preact. The commonly accepted way to write code in this libraries
depends on support for classes, either from the browser itself or a
transpiler like Babel. To use Preact, we have two options:

  * Use ES6 classes. This will work in Firefox 45+ (which includes two ESR
releases), Chrome 42+, Edge and Safari 9 [1][2]. I believe this is a very
reasonable set of browsers, for the staff client.
  * Use a shim for ES3 support (see [3] for an example of how this might
work). This can be done, but locks us to an older and less-used way of
developing on Preact/React.

I strongly prefer the first option, but would like your feedback.

[1] http://kangax.github.io/compat-table/es6/#test-class (Check "show
obsolete platforms", and get ready for your browser to slow down.)
[2] http://caniuse.com/#feat=es6-class (This is pessimistic; FF has had
support since version 45.)
[3] https://github.com/developit/preact-in-es3/blob/master/index.js


-- 
Jesse Weaver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20170803/6223e96e/attachment.html>


More information about the Koha-devel mailing list