1213
Views
11
Comments
"const" is available in ES6
Question

Hi,

I'm trying to use a simple javascript share function that uses the native web-share api on mobile devices.

However when i try to paste the javascript code i get this error:


I found an old topic that told me to use :

/*jshint esversion: 6 */

However that still does not let me publish, the errors are gone in the javascript window. How can i use this function in reactive web apps?


2020-02-28 09-46-54
Eduardo Jauch

Hello Bas,

As far as I know, ES6 is still not supported in OutSystems: https://www.outsystems.com/forums/discussion/30128/p10-how-to-resolve-javascript-warnings-jshint-esversion-6/

This answer was for version 10, but I think it still applies to version 11 as well.

Cheers.

2023-04-19 18-38-51
Bas de Jong

Eduardo Jauch wrote:

Hello Bas,

As far as I know, ES6 is still not supported in OutSystems: https://www.outsystems.com/forums/discussion/30128/p10-how-to-resolve-javascript-warnings-jshint-esversion-6/

This answer was for version 10, but I think it still applies to version 11 as well.

Cheers.

Thanks for the reply, kind of strange since it is available since 2015 already and a widespread JS standard. 

Is there no workaround available to this? (Like loading an external JS file?)

UserImage.jpg
David McCulloch

Bas de Jong wrote:

Eduardo Jauch wrote:

Hello Bas,

As far as I know, ES6 is still not supported in OutSystems: https://www.outsystems.com/forums/discussion/30128/p10-how-to-resolve-javascript-warnings-jshint-esversion-6/

This answer was for version 10, but I think it still applies to version 11 as well.

Cheers.

Thanks for the reply, kind of strange since it is available since 2015 already and a widespread JS standard. 

Is there no workaround available to this? (Like loading an external JS file?)

You can always use babel js to convert your es6 code into es5 code then import it


2020-02-28 09-46-54
Eduardo Jauch

Hi, I will ask around, but I don't think so.

Cheers.

2024-11-07 03-28-42
Stuart Harris
Champion

Bas,

Try changing the 'const' to 'var', like this:


var shareBtn = document.querySelector('.share-btn');


Kind regards,

Stuart

2023-04-19 18-38-51
Bas de Jong

Hi guys,


I have solved it by using the https://babeljs.io/ JS converter. 


Thanks for the replies!

2019-04-25 14-57-49
Mike Neyman

Bas de Jong wrote:

Hi guys,


I have solved it by using the https://babeljs.io/ JS converter. 


Thanks for the replies!

This is a great solution.  Thank you


2020-02-28 09-46-54
Eduardo Jauch

Hello Bas.

Just to add, I was informed that if you extract your JavaScript to a file instead of a node, it should work.

Cheers.

2026-03-09 12-26-51
Fábio Fantato
 
MVP

Hi guys,

I already use const and the hint tag /*jshint esversion:6 */ in mobile and reactive apps and it is working. See below that my Module was published properly. 


2023-04-19 18-38-51
Bas de Jong

Fabio,


I tried that, but the 1 click publish still says that the JavaScript contains errors even though it solved it all.


Eduardo, I will try that tomorrow.

2022-01-27 12-58-26
Vikas Khunteta

After adding this line - 

/*jshint esversion: 6 */

Compilation error went for ES6 error for this "=>", but not able to publish the module.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.