Skip to content

targos/worker-atomics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This experiment creates a minimal, representative proof of concept for an asynchronous ESMLoader behaving synchronously. The most complex features of ESM are import.meta.resolve() and dynamic import() because both of them happen outside the initial module graph yet depend on it (some modules are stateful, like jest and testdouble), so the simplest solution would seamlessly persist state.

This uses a worker and Atomics. The Atomics serve as both the communication and data transport vehicles: the main sleeps whenever the worker is active, and the worker sleeps whenever the main is active.

Run the experiment:

node main.mjs

About

Synchronous ops across threads via atomics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%