Skip to content

Attach, remove and trigger events on any object that inherits this small utility.

Notifications You must be signed in to change notification settings

mcgaryes/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Are you ever in need of adding events to non DOM objects in a JavaScript solution. This library attempts to very simply make that posible.

Properties

  • _eventMap - Holds all references to event types, callbacks, contexts and configurations.

Methods

  • on - Attaches an event to the object.
  • off - Removes an event to the object.
  • has - Checks to see if an event is registered to this object with the passed type.
  • trigger - Fires the passed event type on an object.

Usage

var item = Object.create(Events,{});
item.on("customEvent",function(){
	// do something
},this);
item.has("customEvent"); // true
item.trigger("customEvent");
item.off("customEvent");

About

Attach, remove and trigger events on any object that inherits this small utility.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published