[Screen Timer Reactive] The SetInterval function generates errors every now and again
screen-timer-reactive
Reactive icon
Forge component by Francisco Calderón
Application Type
Reactive

Hi

Thanks for the great component and documentation.

I did pick up on my side that every now and again the JS generates errors claiming that the getElementById(btnid) is NULL.

Could you perhaps adjust it a little bit so that the code checks first whether the object is NULL?

function setTimerInterval(btnid, time_ms) {

  return setInterval(

        function(){ 

                var btn = document.getElementById(btnid);

                if(btn !== null) btn.click();

        }, time_ms);

}




Hi Pieter,

Thank you for the positive feedback and suggestion. My apologies too, I remember seeing something similar at a point and for some reason I thought I had already solved those problems. I will get the component updated in the next couple days.

Thanks!

I have published a new version to the Forge with the proposed change. 

Thanks again for the feedback! Please do let me know if you come across any other errors or have any suggestions to improve the asset.

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