How can I run an interaction after x time.

Hello I have a very simple question, I have a series of steps or interactions running after a. button click, however I want the interactions to run after 5 seconds of the click, I’m using the “when” status with multiple codes, one example

`let timePassed = false;
setTimeout(() => {
timePassed = true;
}, 5000);

timePassed == true`

however this only checks if the interaction is true at that particular moment, it doesn’t trigger when its actually true,

i’ve also tried using delays on the dynamic code, function and variable but plasmic just runs everything at once and does not care. so, how can I achieve this?

just for reference I’m capturing a thumbnail of an upload so It needs to be rendered first, so the dynamic url actually shows something. all the logic works but the thumbnail is blank becuase the code wont wait for the file to load.


thanks.

Hey @arturo_rabago,

Plasmic will execute the steps in order BUT will stop at any returned promises until it is resolved.
For example, if I wanted to execute steps after a 5s delay, I would create a a Run code step that runs this line of code new Promise(r => setTimeout(r, 5000)). This would stop all future steps from running until it is resolved.

great! I will try it out, thanks.