gbv / cocoda-winibw

Integration von WinIBW und Cocoda
1 stars 1 forks source link

JavaScript-Polyfills hinzufügen #11

Closed nichtich closed 1 year ago

nichtich commented 5 years ago

Die in JavaScript 1.4. nicht unterstützen Sprachbestandteile könnten bei Bedarf als Polyfill hinzufgefügt werden (siehe JavaScript-Doku bei Mozilla).

stefandesu commented 5 years ago

Ich habe mal eine Wiki-Page dazu erstellt und zum Anfang einen Polyfill für JSON hinzugefügt.

stefandesu commented 5 years ago

Ich habe Polyfills für einige Array-Funktionen zur Wiki-Page hinzugefügt. Dabei ist mir jedoch aufgefallen, dass es vermutlich sinnvoller wäre, einfach einen Transpiler zu benutzen, oder nicht? Dann müsste man überhaupt nicht mehr auf die Syntax achten, weil es alles in ES3/JavaScript 1.4 kompatiblen Code transpiled wird. Großer Nachteil ist, dass man nach jeder Änderung einmal den Transpiler laufen lassen muss, um das Skript in WinIBW zu testen.

nichtich commented 4 years ago

Apparently it's actually possible to transpile to ES3 (https://stackoverflow.com/a/40205612/373710) but polyfills are required still.

stefandesu commented 4 years ago

The argument against a transpiler was that you would have to run it on every change in the code to be able to test it out. With the current solution, we can simply use the code in WinIBW directly, making it much easier to debug and test. Also, I wouldn't be so sure that modern code transpiled to ES3 simply works in WinIBW, so it might cause us more trouble than it's worth.

Is there any specific use case to not simply write in ES3 directly as we have so far?