A template repo for npm packages
A lightweight, modular JavaScript library for managing DOM events and callbacks. The library is designed for flexibility and efficiency, with a focus on leveraging modern JavaScript standards.
- Callback Management: Centralized registration and retrieval of reusable callback functions.
-
Event Handling: Simplified DOM event binding with support for custom attributes (e.g.,
data-aegis-event-on-*
). - Custom Events: Easily define and trigger application-specific events.
- Declarative Attributes: Leverages custom data attributes for declarative event configuration.
npm install @aegisjsproject/callback-registry
import { createCallback, observeEvents, EVENTS } from '@aegisjsproject/callback-registry';
observeEvents();
const el = document.querySelector('.container');
el.setHTMLUnsafe(`<button ${EVENTS.onClick}="${createCallback(({ target }) => alert(target.innerHTML))}">Hello, World!</button>`);