Skip to content

Render virtual DOM as an element and then keep updating it as interesting things (page events) happen

Notifications You must be signed in to change notification settings

ih2502mk/vdom-live

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Virtual DOM Live

Render virtual DOM as an element and then keep updating it as interesting things (page events) happen.

  • bye-bye application state change tracking, observables, digest loops, watches
    • or something
  • great for
    • quick prototyping
    • not worrying about premature optimization
    • writing awesome-sauce codes

Uses requestAnimationFrame to queue and debounce re-renders. Cleans up event listeners when root element is removed from the document tree.

var renderLive = require('vdom-live');

var liveDOM = renderLive(function () {
    return h('span', new Date().toString());
});

document.body.appendChild(liveDOM);

// ... and then let the user click something/etc

Todo

  • remove jQuery dependency (yep, I know)
  • add more events to listen on
  • possibly override setTimeout with a wrapper? audacious!

About

Render virtual DOM as an element and then keep updating it as interesting things (page events) happen

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%