Show spinner while javascript code is loading

Hello!

I need to show a spinner while my JavaScript is loading. I’ve tried using the visibility style inside the JavaScript code but I can’t make it work correctly.

Thanks

If it's a loading spinner for the whole page you could use a preloader:

If it's for a section of the page, you can add the spinner and set
dmx-show="serverconnnectname.state.executing"

Thanks! But I´m running an external JS file. I need to show the spinner while running the JS function.

I think there is a preloader.show() function.
In your JS function, you can use dmx.parse to help you control the pre-loader visibility.

To SHOW: dmx.parse("preloader1.show()")
&
To HIDE: dmx.parse("preloader1.hide()")