Skip to content

arturdoruch/js-event-registry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

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();

About

DOM element events registry.

Resources

Stars

Watchers

Forks

Packages

No packages published