backbone.multi-extend

0.0.10 • Public • Published

Backbone.multi-extend

travis build

multiple inheritance,with super method call, for Backbone classes

Instalation

bower

$ bower i --save backbone.multi-extend

npm

$ npm i --save backbone.multi-extend

global

just checkout backbone.multi-extend.min.js from this repo

Usage

CommonJs

var MultiExtend = require('backbone.multi-extend');

AMD

require(['backbone.multi-extend'], function(){

});

global

<script src="backbone.js"></script>
<script src="underscore.js"></script>
<script src="backbone.multi-extend.js"></script>

Example

var Mixin1 = {
  initialize:function (){
    this.inherited('initialize', arguments);
  }
};

var Mixin2 = Backbone.Model.extend({
  initialize:function (){
    this.inherited('initialize', arguments);
  }
});

var Mixin3 = {
  initialize:function (){
    this.inherited('initialize', arguments);
  }
};

var NewModel = Backbone.Model.extend([{
  initialize: function(){
    this.inherited('initialize', arguments);
  }
}, Mixin1, Mixin2, Mixin3]);

var newModel = new NewModel();
// invoke initialize method in next order
// NewModel.initialize()-->Mixin1.initialize()-->Mixin2.initialize()-->Mixin3.initialize()-->Backbone.Model.initialize()

Package Sidebar

Install

npm i backbone.multi-extend

Weekly Downloads

0

Version

0.0.10

License

ISC

Last publish

Collaborators

  • trskldn