Hi, I get some errors when use " setInterval( )" ...How many errors will you receive if you will not destroy setinterval(). ?Also, can you tell me some good tips/concerning about JS usage in Outsystems? I know that the first rule in Outsystems about JavaScript is, try to don't use JavaScript xD!!
Hi @Samuel Frade,Error will occur every time based on the time specified in setInterval( ) parameter. You should clear the Interval by using clearInterval() as explained below.
RegardsKrishnanand Pathak
Hi Samuel,
When you set up listeners or asynchronous calls to be made, it is indeed important to remove them on the OnDestroy event of the screen, to be prevent them being triggered but no-handler-exists-to-process-them error occurring.
Regarding the usage of JavaScript, ideally you wouldn't need it, and you can take advantage of the platform existing actions to do your work faster but also more readable. However, there are some situations that you need to use JavaScript to extend your app further.
As good practices, I would recommend reading the Extend Your Mobile and Reactive Apps Using JavaScript documentation, use the JavaScript API as well as to explore what OutSystems UI offers out of the box before implementing yourself. For instance, functions like ScrollToElement or SetFocus, among others, are available out of the box, like in the image below:
Kind Regards,João
Hi Samuel Frade
The setInterval() method calls a function at specified intervals (in milliseconds).
The setInterval() method continues calling the function until clearInterval() is called, or the window is closed.
[1 second = 1000 milliseconds.]
-----------------------------------------------------------
1. To clear an interval, use the id returned from setInterval():myInterval = setInterval(function, milliseconds);
2.Then you can to stop the execution by calling clearInterval():clearInterval(myInterval);
Hope this help you
Thank you for these clarifications !