/ears

A backbone like event listener built on Klass

Primary LanguageJavaScript

Ears

A backbone like events listener built on Klass.

Usage

extend Ears with a klass that contains an events object.

var App = Ears.extend()
  .statics({
    events: {
      'click .some .selector': 'someMethod'
    }
  })
  .methods({
    someMethod: function (e) {
      console.log('you clicked somewhere!');
      console.log(e.target); //e.target api is the same as Backbone
    }
  });

  var app = new App(); //events are listening