Skip to content
an opinionated view, somewhat like Backbone's, but with components
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
History.md
Makefile
Readme.md
component.json
index.js

Readme.md

view

Simple, opinionated views using component/dom, component/reactive, 'component/emitter'.

Installation

Install with component(1):

$ component install bmcmahen/view

Example

var View = require('view');
var template = require('./template.html');

function MyView(model){
  View.call(this, template);
  this.react(model);
  this.bind('click .bacon', 'eat');
  this.$bacon = this.$el.find('.bacon');
  model.on('change', this.bound('onchange'));
}

View(MyView);

MyView.prototype.eat = function(e){
  console.log('you ate some bacon!');
};

MyView.prototype.onchange = function(key, val){
  console.log('We can listen to models');
};

var myview = new MyView(model);
dom('#app').append(myview.$el);

setTimeout(function(){
  myview.remove();
}, 5000);

License

MIT

Something went wrong with that request. Please try again.