yysun / apprun

AppRun is a JavaScript library for developing high-performance and reliable web applications using the elm inspired architecture, events and components.

Home Page:https://apprun.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I use other libraries in place of lit-html?

tvardy opened this issue Β· comments

There are very cool competitors for lit-html - eg. HyperHtml, lighterhtml and uhtml by @WebReflection
Do you think I'd be able to use them with AppRun?

You need to let apprun use the render function from_uhtml_:

app.render = utml.render;

Here is an example:
https://apprun-uhtml.yysun.repl.co/

I new there needs to be a trick with the render... didn't think of such an easy one :D

Thanks!

Here is another example:
https://apprun-uhtml-custom-element.yysun.repl.co/

I like uhtml allows passing a function to the onclick attribute.

not sure it's relevant but uhtml and lighterhtml have render(where, what) instead of render(what, where):

render(document.body, html`
  <h1>Hello πŸ‘‹</h1>
`);

it makes it instantly visible where the layout will be placed, as opposite of needing to scroll down templates πŸ‘‹

@WebReflection, AppRun also uses render(where, what) so it is easy to replace the AppRun render engine with uhtml.

app.render = uhtml.render

When using lit-html, we need to switch the parameters.

app.render = (e, v) => litHtml.render(v, e);

Currently, AppRun uses morphdom for supporting HTML string in addition of JSX. I was thinking to replace morphdom with lit-html. I like uhtml more now.

uhtml uses udomdiff, in case it's needed πŸ‘