0.0.8 • Published 7 years ago

backbone.tendon v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

backbone.tendon

Backbone Tendon lets you define the events hash in a different manner.

example

const GoButtonView = Marionette.ItemView.extend({
  template: _.template('<button data-tendon="go" value="2">GO!</button>'),
  el: 'body',
  onClick: {
    go({ value }) {
      console.log('go', 'value is', value);
    },
    any({ value, e, target, name }) {
      console.log('clicked', $target);
      // name here is the data-tendon="" attributes value
    }
  },
  onBlur: {
    name({ value, e, preventDefault }) {
      console.log(value);
      console.log(e);
    },
  },
  initialize() {
    this.tendon($); // pass jquery to get a jquery wrapped $target instead of a "native" target
  },
});

const goButton = new GoButtonView();
0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

8 years ago

0.0.1

8 years ago