Skip to content

[FEATURE REQUEST] Add microtask / queueMicrotask support #11

@tungs

Description

@tungs

Is your feature request related to a problem? Please describe.
Currently microtasks aren't considered when iterating through time. Timeweb currently iterates through time in a loop, which doesn't allow for queued microtasks to run.

Describe the solution you'd like
It may be useful if processNextBlock used recursive calls to queueMicrotask, so if any of the functions run with setTimeout/setInterval that queue microtasks would run before the next iteration timeouts/intervals. Also it's worth considering whether other sequential parts of timeweb should relinquish to microtasks (events, requestAnimationFrame)

Describe alternatives you've considered
None.

More Considerations
Microtasks may also be useful when trying to save webgl canvas data before it becomes stale, though I'm not sure about hte lifecycle of canvas data.

Additional context
queueMicrotask API
Guide to Microtasks

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions