Which feature of JavaScript can we use in Custom Widget?

I run my Apps on Windows Tulip Player and iOS Tulip Player.
I want my Custom Widgets to run safely on both Players.
Is there a easy way to know which Tulip Player version supports which JavaScript features?

For instance, can I use “Spread syntax”?
Spread syntax (…) - JavaScript | MDN

I became afraid about this because the editor does not understand it.

I am by no means a javascript expert. I can tell you that when building a custom widget for building a JWT for communications with PDFGeneratorAPI, I also had “unrecoverable syntax errors”. It was fixed by replacing “const” with “var” (const secret_in = “”; was replaced with var secret_in = “”). That could be the source of your unrecoverable syntax error.

Thank you!
I think the tool tip message “Unrecoverable syntax error” from the Custom Widget code editor can be ignored in that case.
It is generally a good practice not to use “var” in JavaScript.

Thanks to @DarrelAms for getting to this thread before me.

To add to this, Taichi is right - the message is safe to ignore. The code editor’s syntax checker is older than some JavaScript features, so it flags valid code like object spread ({ ...a }), optional chaining (a?.b), nullish coalescing (a ?? b), ** and class fields. The widget still runs fine, const and let work too, and the checker accepts them - so switching to var shouldn’t be needed.

What you can use depends on where the app runs. To check a feature, open its MDN page and look at the Browser compatibility table:

  • Tulip Player for Windows and macOS: the Chrome row
  • Tulip Player for Android: the WebView Android row
  • Tulip Player for iOS: the Safari on iOS row
  • Web browser: that browser’s row

Thank you for the comment.
The problem is that we do not know which version of the Chrome/WebView/Safari the Tulip Player is built on.

Maybe Tulip can write it on Tulip Player Releases ?

Or maybe we (Custom Widget developers) just have to test with all the type of Players before releasing it.

Thanks @ta-aoki, fair point. Below lists where each each version comes from:

  • Tulip Player for Windows and macOS: current Player versions use Chromium 146 or later. This is the only one where the Player itself sets the version.
  • Tulip Player for Android: uses the device’s Android System WebView, which updates through Google Play, so the version depends on the device rather than the Player.
  • Tulip Player for iOS: matches Safari on the device’s iOS version.

To confirm on a specific device, log navigator.userAgent from your widget. It shows the Chrome or WebView version, or the iOS version on an iPhone or iPad.

Adding the Chromium version to the Player Releases page is a good suggestion, and I’ll pass it along to the team. Until then, testing on each Player type you deploy to is the safest approach, especially iOS, since it runs a different engine from the other two.