Why?
Creating WebComponents shouldn't be limited to extending classes and it should use native solution and no magic.
Osagai is a library that make WebComponents easier to create and use with only composing functions and template literals.
Creating WebComponents shouldn't be limited to extending classes and it should use native solution and no magic.
Osagai is a library that make WebComponents easier to create and use with only composing functions and template literals.
Create and easily define WebComponents using functions. No needs to extends classes and OOO things.
Update when you say to update. It compares the current DOM tree with the new one and update only what it needs to be updated using the amazing Morphdom library.
Take advantage of WebComponents purpose and use your component in whatever Framework/Library.
Osagai export a define()
function to create your WebComponent. Your component is a function that returns a template with the view definition
In addition, in you component function it will be injected some useful methods like query
that you could query inside the component tree and add event listeners with the on
method from osagai/events
.
Besides query
, Osagai will also inject an update
function that you can use for changing the data (or state) being used in the template function. This will check what it needs to be changed in the DOM and apply the re-render