Skip to content

creativej/eventable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Eventable

A simple lightweight event object for javascript that does not tie in with the DOM.

Basic usage:

var obj = eventable();

obj.on('update', function() {
  console.log('update event triggered');
});

obj.trigger('update'); // logs: update event triggerred

You could pass an existing object as well.

var model = eventable({});

obj.on('update', function() {
  console.log('update event triggered');
});

obj.trigger('update'); // logs: update event triggerred

You can remove events

obj.off('update');
obj.trigger('update'); //Does nothing

About

A lightweight constructor for creating event objects that does not tie in with DOMS.

Resources

Stars

Watchers

Forks

Packages

No packages published