Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » Asynchronous get_status?
- randsk
- New to Scratch
7 posts
Asynchronous get_status?
Hi,
i have some code working now that uses some “blocks that wait” - the do some async code: https://github.com/LLK/scratchx/wiki#command-blocks-that-wait
With these blocks you can kick off some work (web socket, ajax etc) and then invoke a ‘callback’ to tell scratch you're done (and to move onto the next block etc)
I need a similar kind of approach for the get_status function, however this seems very much synchronous. I could implement the function synchronously myself, but i'm worried about locking up the scratch UI.
Any thoughts please?
i have some code working now that uses some “blocks that wait” - the do some async code: https://github.com/LLK/scratchx/wiki#command-blocks-that-wait
With these blocks you can kick off some work (web socket, ajax etc) and then invoke a ‘callback’ to tell scratch you're done (and to move onto the next block etc)
I need a similar kind of approach for the get_status function, however this seems very much synchronous. I could implement the function synchronously myself, but i'm worried about locking up the scratch UI.
Any thoughts please?
- MegaApuTurkUltra
- Scratcher
1000+ posts
Asynchronous get_status?
What is your extension doing on get_status that takes so long? Hi,
i have some code working now that uses some “blocks that wait” - the do some async code: https://github.com/LLK/scratchx/wiki#command-blocks-that-wait
With these blocks you can kick off some work (web socket, ajax etc) and then invoke a ‘callback’ to tell scratch you're done (and to move onto the next block etc)
I need a similar kind of approach for the get_status function, however this seems very much synchronous. I could implement the function synchronously myself, but i'm worried about locking up the scratch UI.
Any thoughts please?
You could try doing the work in the background and returning a cached value on get_status
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- randsk
- New to Scratch
7 posts
Asynchronous get_status?
That's not a bad idea, thanks.
Same as my last post you replied to - I need to talk to a companion app to issue commands. However I want to make sure everything remains responsive if the app is down, or the device it controls is not connected yet.
Cheers
Same as my last post you replied to - I need to talk to a companion app to issue commands. However I want to make sure everything remains responsive if the app is down, or the device it controls is not connected yet.
Cheers
- MegaApuTurkUltra
- Scratcher
1000+ posts
Asynchronous get_status?
Well then just constantly ping the app every 10 seconds or so, and if it's down then start returning a not ready status. That's not a bad idea, thanks.
Same as my last post you replied to - I need to talk to a companion app to issue commands. However I want to make sure everything remains responsive if the app is down, or the device it controls is not connected yet.
Cheers
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- TurtleLegos
- Scratcher
1000+ posts
Asynchronous get_status?
Dude, this is the third topic in a row. The OP is inactive. Bumper
BE DRY, MOIST IS TOO MOIST
hey im back! march 3 2024
- Discussion Forums
- » Developing Scratch Extensions
- » Asynchronous get_status?