Start Client Function After Delay

Start Client Function After Delay

  

Hi,

I need to check the status of a thing after a short time, then call it again and again if something (being checked each time) is still false. This is in a mobile app.

To create the delay I have tried calling a javascript function which uses settimeout to alter an outsystems variable after 3000ms. I do this by using an input field tied to that variable and use a getDocument....value="..." type call.

I then thought that onrender would fire for that block as the variable changed and I could use logic looking at the value of the outsystems variable to ensure I need to run the next action, but it doesn't fire. I thought instead to tie an input variable to that input field and hope that 'parameters changed' event would fire, but again no luck.

Last I have tried using the on-change event of the input field but again it doesn't fire.

Perhaps I'm trying a silly route of using a javascript function in this way.

Perhaps I should use a javascript which has a pointless while loop checking the time until 3 seconds have passed to literally pause that process and wait. I could put that in a function which calls itself if the situation requires it. I'll try that. Any suggestions welcome.

Thanks,

Danny

Solution

Hum...

Why don't you use your JavaScript function with the timer to call directly a client action?

You have access to client actions through $actions (if I am not mistaken...)

Cheers. 

Solution

Ah... Sorry Eduardo, I feel like I should have known / noticed that! So obvious. Thanks as always!