YoYoGames/GameMaker-HTML5

Games no longer work in older iOS Safari versions due to the nullish coalescing operator (??) and public field declarations

filippgit opened this issue · 6 comments

The nullish coalescing operator (??) is not supported in iOS Safari versions older than 13.3: https://caniuse.com/mdn-javascript_operators_nullish_coalescing

Public field declarations are only supported since version 14.5: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields#browser_compatibility

Both issues specifically crash games on startup on iPhone 6.

I think both features could use a polyfill to support older devices. The nullish coalescing operator can be replaced with a function like this:
function _NCO(a,b) { var _c; return (_c = a) !== null && _c !== void 0 ? _c : b; }

Likely related to what I reported... last year: #59

Just out of curiosity, why did you close this issue?
Edit: nevermind, it's reopened :) I was getting worried this issue is gonna get swept under the rug.

Likely related to what I reported... last year: #59

Yes, it's the same issue. While I managed to manually replace ?? with a polyfill, the second error is related to the usage of the PannerNode constructor, which is unsupported in mobile Safari prior to v14.5. It is used for new audio features (specifically, 3D audio) and is a bit tricky to replace, so I've ended up using an older GM version at the moment. Maybe the dev team can resolve it better than I.

rwkay commented

We are actually looking at this now... discussing what should be done

You use a transpiler like Babel.

Please learn from an established repository like https://github.com/playcanvas/engine

(there is potential to improve a lot of JSDoc tags too... quite fast if you use an IDE like VSCode)

rwkay commented

This has been fixed for a long time... it was in the 2023.8 release