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?
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.
Eduardo Jauch wrote:
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?)
Bas de Jong wrote:
You can always use babel js to convert your es6 code into es5 code then import it
Hi, I will ask around, but I don't think so.
Bas,
Try changing the 'const' to 'var', like this:
var shareBtn = document.querySelector('.share-btn');
Kind regards,
Stuart
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
Hello Bas.
Just to add, I was informed that if you extract your JavaScript to a file instead of a node, it should work.
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.
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.
After adding this line -
Compilation error went for ES6 error for this "=>", but not able to publish the module.