Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 611 Bytes

README.md

File metadata and controls

35 lines (25 loc) · 611 Bytes

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