Page 1 of 1
html5 wait command (workaround)
Posted: Mon Jul 15, 2019 7:04 pm
by seaniepie
A simple bit of code to produce an alternative for 'wait' that works for html5 deployment:
Code: Select all
on waitFor pMS
put the millisec into tMS
put the millisec - tMS into tMSDiff
repeat until tMSDiff >= pMS
put the millisec - tMS into tMSDiff
end repeat
end waitFor
Obviously, this causes the stack to hang and can't process any messages. One handy thing though is that buttons and other UI items also become unresponsive, so it prevents user interaction during this time (without affecting the rest of the browser).
I'm working on a way to do it with messages. I'll post here when I'm done.
Pi
Re: html5 wait command (workaround)
Posted: Mon Jul 15, 2019 8:28 pm
by [-hh]
You could simply use "send in <time>". It's better than wait, not only a workaround.
Re: html5 wait command (workaround)
Posted: Mon Jul 15, 2019 8:49 pm
by seaniepie
So, amazingly, send "{command}" to me in 2 sec works, even though wait can't. Therefore, wait with messages is easy(ish). You just split up your code:
Code: Select all
on myCommand_1
-- Do some stuff...
send "myCommand_2 tMyParametersToPassInAnArray" to me in 1 second
-- ^ Is the same as 'wait 1 sec with messages' ^
end myCommand_1
on myCommand_2 pParameterArrayPassedFromPreviousHandler
-- Break out the parameters if you don't want to carry on using them in the array...
-- Carry on and do more stuff...
end myCommand_2
Simple!
Pi
Re: html5 wait command (workaround)
Posted: Mon Jul 15, 2019 9:08 pm
by seaniepie
[-hh] wrote: ↑Mon Jul 15, 2019 8:28 pm
You could simply use "send in <time>". It's better than wait, not only a workaround.
Sorry, Hermann, only just noticed this post. I (wrongly) assumed that because wait didn't work (heaven knows why - JS can do a wait functions) that 'send in' wouldn't either.
My SQL library is just about done.
Re: html5 wait command (workaround)
Posted: Tue Jul 16, 2019 10:26 am
by sphere
That would be awesome and give huge advantages if we can use Mysql with html5
