Skip to content

leechy/events.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

events.js

“Every developer must create his own event manager”

Simple events manager that gives you the ability:

  • to attach event handlers to any element with document by default;
  • to trigger events with custom data (via detail param);
  • to emulate triggering the DOM event calling the saved function to solve some problems with popup blockers.

ToDo:

  • removing handles.

Usage

include events.js in your html-page:

<script type="text/javascript" src="event.js"></script>

Attach event listener to all elements on a page:

events.handle('click', 'button', callbackFn);

Attach event listener to the document:

events.handle('my-custom-event', callbackFn);

Trigger custom events with additional data:

events.trigger('my-custom-event', { 'user-id': 123, 'age': 12 });

About

Every developer must create his own event manager

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published