Neanderthals Programming Machines
Wondering what’s next for npm?Check out our public roadmap! »

@arturdoruch/event-registry

1.0.2 • Public • Published

Event registry

DOM element events registry.

Install

yarn add @arturdoruch/event-registry

Usage

import eventRegistry from '@arturdoruch/event-registry';

function consoleListener(e, firstArgument, secondArgument) {
    console.log(firstArgument);
    console.log(secondArgument);
}

// Register event listener to the DOM element.
const eventId = eventRegistry.on('click', 'h1', consoleListener, ['firstArgument', 'secondArgument']);

// Trigger event manually.
eventRegistry.trigger(eventId);

// Remove event listener.
//eventRegistry.off(eventId);

// Register event listener to the DOM element, which will be called only once.
//eventRegistry.one();

Install

npm i @arturdoruch/event-registry

DownloadsWeekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

5.31 kB

Total Files

3

Last publish

Collaborators

  • avatar