Fix: Replace ES6 getters/setters with ES5-compatible functions in HTML5 runtime (Closure Compiler error)
Summary
This PR fixes a critical issue preventing Clickteam Fusion 2.5 HTML5 builds when using extensions created with the DarkEdif SDK (SDK v20).
The Fusion HTML5 exporter uses the Google Closure Compiler, which does not support ES6 getters/setters and fails to transpile them to ES5.
Because of this, any extension using DarkEdif v20 cannot be exported as HTML5.
Problem
During HTML5 build, Fusion throws:
ERROR - This code cannot be converted from ES6. ES5 getters/setters (consider using --language_out=ES5)
get setIndexSelected() {
^^^^^^^^^^^^^^^^
This comes from auto-generated code in RuntimePropSet, inside the DarkEdif HTML5 runtime:
get setIndexSelected() {
return rsDV.getUint16(1 + (2 * 4), true);
},
set setIndexSelected(i) {
rsDV.setUint16(1 + (2 * 4), i, true);
},
Closure Compiler cannot convert ES6 getters/setters → ES5, so the entire HTML5 build fails.
Solution
Replaced the ES6 getter/setter with ES5-safe functions:
Before (ES6, incompatible)
get setIndexSelected() {
return rsDV.getUint16(1 + (2 * 4), true);
},
set setIndexSelected(i) {
rsDV.setUint16(1 + (2 * 4), i, true);
},
After (ES5-compatible)
getSetIndexSelected: function() {
return rsDV.getUint16(1 + (2 * 4), true);
},
setSetIndexSelected: function(i) {
rsDV.setUint16(1 + (2 * 4), i, true);
},
Additionally, all internal references were updated:
-
obj.setIndexSelected = x→obj.setSetIndexSelected(x) -
obj.setIndexSelected(read) →obj.getSetIndexSelected()
Why this fix is necessary
✔ Restores HTML5 export support ✔ Keeps full compatibility with Smart Properties ✔ No behavior changes ✔ Only removes ES6 syntax that Closure cannot handle
Impact
- HTML5 builds now compile successfully.
- No impact on Windows, Android, or other runtimes.
- Safe, minimal, runtime-only patch.
Ready to merge
This PR contains the minimal and necessary change to re-enable HTML5 compatibility in DarkEdif SDK v20.