Drow.js: A Practical Look at the Tiny Web Components Library
Drow.js is a lightweight library designed to simplify the creation of Web Components. It allows developers to define components as plain JavaScript objects rather than using class inheritance. With features like CSS scoping and event handling, Drow.js aims to streamline the development process while keeping the library size minimal.
- ▪Drow.js is under 1kb gzipped and has zero dependencies.
- ▪Components in Drow.js are defined as plain JavaScript objects, making them easier to configure.
- ▪The library includes features like CSS scoping, an init hook for interactivity, and a watch function for attribute changes.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 238867) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } John Facey Posted on May 20 Drow.js: A Practical Look at the Tiny Web Components Library #javascript #frontend #webdev Drow.js: A Practical Look at the Tiny Web Components Library If you've built a Web Component before, you've probably written something like this: class MyComp extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { // boilerplate setup } // lifecycle methods } customElements.define('my-comp', MyComp); Enter…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).