Giter VIP home page Giter VIP logo

async-dom's Introduction

async-dom

Async Dom



2 apps separately running in web-workers, using async dom https://lifeart.github.io/async-dom/

Supported WebWorker/NodeJs websockets DOM implementations

  • Pseudo Dom
  • JSDom
  • Simple Dom
  • Domino

Features

  • 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)

How to run glimmer streaming from websockets?

  1. npm install
  2. npm run serve
  3. visit http://127.0.0.1:8080

Logic

  1. All DOM modifications collected in single pool
  2. For each requestAnimationFrame we create fittable modifications list (pool slice)
  3. If our modifications took more than 16ms, we put remaining modifications back to pool
  4. 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)

Description

This is a proof of concept of asynchronous DOM modification example with:

  • event binding
  • DOM modifications batching
  • 60 fps performance
  • optional DOM updates

Main thread (DOM EventLoop)

  • Only DOM update logic

WebWorker

  • Business logic
  • All DOM modifications came from WebWorker and applyed to Main thread DOM

RealLife usage?

  1. Share NDA UI's (user can't copy js logic) / for UI demos
  2. SmartTV -> execute complicated buisiness logic (math) on backend and stream smooth ui
  3. Marketing - > track user experience (websocket can broadcast ui changes for multiple users)
  4. Parallel editing demo -> catch events from 2+ users and apply to single app
  5. Internet of things -> execute app and stream result to any device
  6. DOM rendering time-traveling for JS frameworks debugging
  7. Rendering testing -> if snapshots/chunks are same - UI is good
  8. 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
  9. You can use async-dom to create bridge for react-native etc -> glimmer working with DOM -> DOM modifications converted to react-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 )
  10. Usage in Quizz/Exam/Education solutions / user can't cheat, because have no access to apis and source code

async-dom's People

Contributors

dependabot[bot] avatar lifeart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

async-dom's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.