Clear Interval OnDestroy event in reactive web application.
Question

Hi,

I have a requirement in which user wants to autosave the form after particular interval of time. In order to achieve that I am running following javascript in ONReady event action.


var myVar = setInterval(myFunction, 10000);

function myFunction() {

  document.getElementById("AutoSaveButton").click();

}

When user leaves the screen I am trying  to use clearInterval()  in OnDestroy event action to clear the setInterval but not sure how to approach it. 

Thanks



mvp_badge
MVP

Hi 

The last reply in the post that Benjith shared  https://www.outsystems.com/profile/ms0h0s23ew/ should solve your problem.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi 

The last reply in the post that Benjith shared  https://www.outsystems.com/profile/ms0h0s23ew/ should solve your problem.

Regards,

Daniel

 

Hi, 

It worked for me.

Thank you.

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