Currently my webapp recieves websocket data to trigger actions.
This breaks upon page reloads therefore I want a client-side solution where I be able to trigger a certain event.
Is this idea possible?
Say you have
- TimeX = 10 seconds from current_time should start trigger X
- TimeY = 20 seconds from current_time should start trigger Y
-
TimeZ = 30 seconds from current_time should start trigger Z
- Would it be possible to store these inside the html and have some countdown trigger execute when the seconds have been countdown to zero?
- What if a browser would redirect just when between countdown 0-1 would it be possible to trigger the event still, with say a 2/3 failover time?
I have modest jQuery experience would love to hear some feedback and thoughts on this. Thank you in advance
You would need to use
setInterval()to set a delayed call to a function. Something like this: