DEV Community

Discussion on: Resumable JavaScript with Qwik

Collapse
 
drsensor profile image
૮༼⚆︿⚆༽つ

I guess every event handler will be executed in the microtask since it came from `await import()'. I wonder what would happen if I run physics engine computation on mouse click 🤔
(normally it should be run inside a webworker but running in the main thread give a better startup time)

Collapse
 
peerreynders profile image
peerreynders • Edited

How we cut 99% of our JavaScript with Qwik + Partytown

Partytown and Qwik are both projects at BuilderIO. Going by a recent interview they have every intention for Qwik applications to leverage web workers to immediately download and run the heavier parts - restricting the main thread to only what is essential to support the UI.


Earlier in that same interview:

"... at some point you know the client might go back to the server and say like did any of these things change or i'm deleting one or whatever right and that's up to application to kind of figure out how that that works.

How do you dictate that in Qwik?

You don't, like that's outside of the responsibility Qwik you just have data, you just have objects".

The implication is that Qwik isn't running the entire client side application but that Qwik is focused entirely on the UI aspect and its supporting state - so "the rest of the client side application" could partly or as a whole be running on a web worker.

Collapse
 
drsensor profile image
૮༼⚆︿⚆༽つ

Here is a simple scenario in gamedev (with parallelize ECS) where you don't want to lazy load the event handler nor put them in the queuMicrotask

<button on:click=(() => {
  for (const [typedArray, offset, [entity, health]] of queryRaw(enemyHealth)) {
    Atomics.sub(typedArray, offset, 20)
    physicsKnockback(entity, 50)
  }
})>
Enter fullscreen mode Exit fullscreen mode