Async Dom
2 apps separately running in web-workers, using async dom https://lifeart.github.io/async-dom/
- Pseudo Dom
- JSDom
- Simple Dom
- Domino
- Scoped DOM (support multiple workers and applications rendering in single DOCUMENT at one time)
- Support multiple DOM implementations
- Ability to batch WW messages
- Ability to skip some DOM changes
- Ability to stream DOM updates from nodejs server
- Render VM on main thread with custom rendering control (frames batching, ordering, etc)
npm install
npm run serve
visit http://127.0.0.1:8080
- All DOM modifications collected in single pool
- For each
requestAnimationFrame
we create fittable modifications list (pool slice) - If our modifications took more than 16ms, we put remaining modifications back to pool
- Repeat all operations for next frame
- DOM modifications are sorted for optimal "rolling changes" (first create an element, add styles, and then add to DOM (not create an element, add to DOM, add styles))
- Optional DOM modifications (if the performance does not allow this modification, it is thrown out of the queue)
- Modifications orioritization and batching (you can create an array of modifications that will always be executed within a single frame)
This is a proof of concept of asynchronous DOM modification example with:
- event binding
- DOM modifications batching
- 60 fps performance
- optional DOM updates
- Only DOM update logic
- Business logic
- All DOM modifications came from WebWorker and applyed to Main thread DOM
- Share NDA UI's (user can't copy js logic) / for UI demos
- SmartTV -> execute complicated buisiness logic (math) on backend and stream smooth ui
- Marketing - > track user experience (websocket can broadcast ui changes for multiple users)
- Parallel editing demo -> catch events from 2+ users and apply to single app
- Internet of things -> execute app and stream result to any device
- DOM rendering time-traveling for JS frameworks debugging
- Rendering testing -> if snapshots/chunks are same - UI is good
- You can run zoo of frameworks/(different versions of framework) on one page in web workers and use all of them, without iframes and side effects
- You can use async-dom to create bridge for
react-native
etc -> glimmer working with DOM ->DOM
modifications converted toreact-native
events using async-dom, you don't need to use custom(platform) dom implementation, all you need - write dom converter, but i'm not sure ) - Usage in Quizz/Exam/Education solutions / user can't cheat, because have no access to apis and source code