Coder Social home page Coder Social logo

Use lit-html internally about hybrids HOT 5 CLOSED

DavideCarvalho avatar DavideCarvalho commented on September 23, 2024 1
Use lit-html internally

from hybrids.

Comments (5)

smalluban avatar smalluban commented on September 23, 2024

lit-html is still in rapid development. They recently merged core and extended library, changed syntax, etc. In the time when I was creating template engine (from March to May) it was really different, and in my opinion really confusing. They had a lot of issues about how to use it, or that people does not understand why something was not working (like missing the fact of extended version, which had to be used).

The main reason behind creating own implementation was a different public API. The hybrids solution favors using element context as a main argument of event listeners, gives a user full power without need to use additional tools (as directives for class and style introduced lately in lit).

However, as the hybrids is very flexible library, there is nothing to stops you from using lit-html with the library. The only thing you have to do is a little wrapper over render factory, as the html method in lit returns TemplateResult, not an update function.

from hybrids.

smalluban avatar smalluban commented on September 23, 2024

Is there anything else I can help you with this subject your welcome to ask :). If no, I will close the issue.

from hybrids.

dredzone avatar dredzone commented on September 23, 2024

Can you provide an example how lit-html or hyperhtml render can be used instead of default?

from hybrids.

smalluban avatar smalluban commented on September 23, 2024

Sure!

https://stackblitz.com/edit/hybrids-lit-html-counter?file=lit-counter.js

Instead of passing directly template result (using the built-in engine), for lit, you simply wrap a function with lit() function and use html from lit-html. For simplicity, it is re-exported in the wrapper file - lit.js.

I put some comments to explain why something is done in that or another way. Some of the API differences force to not use destructuring and require passing context to the event listener.

from hybrids.

dredzone avatar dredzone commented on September 23, 2024

very helpful, thanks for quick response.

from hybrids.

Related Issues (20)

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.