1.0.3 • Published 8 years ago

backbone.component v1.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

Backbone model without attributes

This package describes light version of the Backbone.Model. You can use this component when you doesn't need the Backbone.Model attributes functionality like model.set() or model.get() methods and change events. But this component have all Backbone.Events functionality.

Properties assign functionality

This component have a properties-assign logic. This means, that when you create the component, you can pass object with properties in first constructor argument. Look at the usage example below.

Usage example

You can find this code in sample folder.

'use strict';
 
const Component = require('backbone.component');
 
const Person = Component.extend({
  name: null
});
 
const Man = Person;
 
const Woman = Person.extend({
  want(target) {
    this.trigger('want', target);
  }
});
 
let john = new Man({name: 'John'});
let kate = new Woman({name: 'Kate'});
 
john.listenTo(kate, 'want', target => {
  console.log(`${kate.name}, ${target} is really expensive!`);
});
 
kate.want('car');

Also you can run this code from console from your project folder.

node ./node_modules/backbone.component/sample/index.js

Installation

Run this code from your project root folder.

npm i backbone.component --save-dev
1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago