JSideris / DOThtml

A human-friendly way to build highly-dynamic web pages in pure JavaScript.
2 stars 4 forks source link

Deferred calls shouldn't have a timeout. They should happen after the last element is added to the DOM, somehow. #111

Closed JSideris closed 1 year ago

JSideris commented 3 years ago

The purpose is to prevent flickering when the page loads, which is currently the behavior with the timeout implementation.

It's a tricky problem, but it's possible. Consider this:

dot("body").div("a").div(dot.defer(function(d){d.h("b")})).div("c");
  1. dot.("body") targets the dom.
  2. `div("a") draws the fist element to the dom.
  3. div(dot.defer(function(d){d.h("b")})) requires the deferral to evaluate first.
  4. dot.defer(function(d){d.h("b")}) Sets up the deferral. This should be a special object that the parent element will know how to process.
  5. The second outer div is rendered to the DOM with nothing in it (or maybe with a <dothtml-defer> element in it).
  6. After that's been added to the DOM, the element is immediately rendered.
JSideris commented 1 year ago

Deferred UI was a mistake and doesn't have any merit or legitimate use cases. Aborting.