Thanks Jed. I've actually made some tests with setTimeout in a custom JavaScript widget and have realised that setTimeout only delays a function that it is calling.
What this means is that the setTimeout method will have no effect on any subsequent actions that may be defined in any* separate* action widgets that are stacked below it, because any functions defined there will simply be out of scope for the function defined in our current timeout widget. Please correct me if I'm wrong, but from what I've understood, all action widgets are self contained/sandboxed in this respect by design (due to security?) or maybe it's just due to JS multi-threading, I have no idea. Either way, it appears that setTimeout will not just magically delay JS operations globally, not least in any subsequent action widgets. Thanks, Hubert On Wednesday, 6 May 2020 11:41:22 UTC+1, Jed Carty wrote: > > Somewhere I have some experiments with something like this. A much safer > alternative is to have a background daemon running that emits some event > every so often and use that as a clock, then your widget counts pulses (or > waits until after a specific time) and then acts. > > So you could have the background daemon emit a pulse event every second, > then you have an action widget that will count a certain number of pulses > before before running the action widgets that it contains. > > I hope that makes sense. I have run into a few cases where this would be > useful for me in the last few days, but I am not sure how long it will be > before I will have the time to make it. > > Alternately you could go the easier route and just use a setTimeout in the > widget that waits however long you want before running the code. That is > how the background daemon would work anyway, the only reason to not use > that is that the time would only be accessible inside the widget instead of > a globally available clock. > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/fe19e7dd-bd3a-4370-9539-9b6de7cd332b%40googlegroups.com.

