0.2.2 • Published 2 years ago

uwhen v0.2.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Custom elements without customElements.define

import when from "uwhen";

(() => {
	setTimeout(() => {
		const el = document.getElementById("tag");
		el.setAttribute("val", "UWhen");
		setTimeout(() => {
			el.remove();
		}, 2000);
	}, 2000);
})();

when("my-tag", (el) => {
	return {
		connected: () => (el.textContent = `Hello ${el.getAttribute("val")}`),
		disconnected: () => console.log("disconnected", el),
		attributeChanged: (name, oldValue, newValue) =>
			(el.textContent = `Hello ${newValue}`),
		observedAttributes: ["val"],
	};
});
<my-tag val="World" id="tag"></my-tag>

Courtesy: When-elements

0.2.1

2 years ago

0.2.0

2 years ago

0.2.2

2 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago