Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 559 Bytes

README.md

File metadata and controls

15 lines (13 loc) · 559 Bytes

WJEvents

Inspired by Backbone Events, I build my own eventlistener to extend on classes.

Usage

It is possible to use WJEvents directly, but it more usefull to extend it on your classes. in example/ is a simple example of how it can be used. Below is a small guide:

  • extend(myClass, WJEvents);
  • myClass.on('name-of-the-event', myFunction);
  • myClass.trigger('name-of-the-event1, arg1, arg2, ...);

Functions

  • .on(eventName, callback)
  • .once(eventName, callback)
  • .off(eventName, callback)
  • .trigger(eventName, arg1, arg2, ...)
  • .kill()