Stonecrusher Stonecrusher - 1 year ago 155
Javascript Question

Does UI5 support current ecmascript out of its library?

Does sapui5 support ecmascript6 (or 5) directly from its library? In other words: when I use the sapui5 library am I then independent of browsers that do not yet support ecmascript6 (or 5)?
And if sapui5 does support ecmascript out of its lib, which sapui5 version supports which ecmascript version?
If there are only some polyfills like for example the ES6 promise, what are they? Are they specified somewhere in the API so I can safely use and rely on them?

I have searched for "sapui5 ecmascript" here on browserstack but did not find any answer. I searched the Openui5 Toolkit but also did not find this desired info there. The only suitable info I've found did not give me the answer to my question.

Answer Source

There are some polyfills in SAPUI5. A search in the OpenUI5 Github lists Promise, string.prototype.normalize(), Array.prototype.every() and Array.prototype.indexOf(). But i guess this list is not complete.

I think you cannot rely on them. They are not officially documented. Most of them are only loaded and applied when needed by some controls or classes. Also beware that SAP can change the implementation of the polyfills at any time and change the conditions when the polyfills are applied and when not.

As an example the Promise polyfill has not been applied to Safari (which has a native Promise) until SAPUI5 v1.34.0, and MS Edge (which also has a native Promise) until SAPUI5 version 1.34.4 (changelog).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download