You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New docs are looking great. 👍
Was looking through webworkers and thought you might want to add a starter function which might be used when the page starts up to pre-initialise the workers so they are ready sooner.
I took this from a prior code version so it probably needs some refining, updating to 2026.1.1, and to be in a function
but something like this could be useful to add
# start workers but no handles to use and have to wait - so use ltk.schedule insteadforelinwindow.document.querySelectorAll("[type='py'][worker][name]"):
print("found",el, el.id)
print(workers, workers.id, workers.name)
el.onload(ltk.proxy(lambdae: print("loaded",e)))
print(dir(el))
awaitworkers[el.getAttribute('name')]
@Neon22 I am not sure el.onload makes sense in there, because the script is handled by JS, not by the browser, load event in there might not be triggering the way you expect.
On top of that, it looks like this way you still await one worker after the other, which is OKish but I'd rather do it this way:
Seems much better than what I cobbled together from an earlier build.
Please consider adding it to the docs.
I think it would be useful to be able to kick the Workers off before needing them, so that the "app" would be even more responsive.
Activity
WebReflection commentedon Jan 22, 2026
@Neon22 I am not sure
el.onloadmakes sense in there, because the script is handled by JS, not by the browser,loadevent in there might not be triggering the way you expect.On top of that, it looks like this way you still await one worker after the other, which is OKish but I'd rather do it this way:
this would await in parallel all workers, not one after the other, so if the order does not matter, that's the way I'd go.
Neon22 commentedon Jan 22, 2026
Seems much better than what I cobbled together from an earlier build.
Please consider adding it to the docs.
I think it would be useful to be able to kick the Workers off before needing them, so that the "app" would be even more responsive.
Cheers...