DailyJS

Kettle.js, Backbone.SuperModel, Mem.js

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

mvc backbone mvvm

Kettle.js, Backbone.SuperModel, Mem.js

Posted by Alex R. Young on .
Featured

mvc backbone mvvm

Kettle.js, Backbone.SuperModel, Mem.js

Posted by Alex R. Young on .

Kettle.js

Kettle.js (GitHub: smelnikov / kettle, License: MIT) by Sergey Melnikov is an alternative approach to Backbone views that uses a declarative syntax to define elements, their bindings, and their associated events.

It supports two-way data binding, sub views, and can be extended to support custom Kettle elements.

Mem.js

Mem.js (GitHub: artyomtrityak / mem.js, License: MIT) by Artyom Trityak is a memory management library for Backbone. It allows you to save, retrieve, and destroy instances of Backbone classes:

var View = Backbone.View({});

// On set returns new stored function instance or object
var headerViewIns = Mem.set('headerView', View, { el: 'body' });  

It can remove and recreate instances with Mem.reset, and remove outdated objects with Mem.manage.

Backbone.SuperModel

Backbone.SuperModel (GitHub: laoshanlung/backbone.supermodel, License: MIT, npm: backbone.supermodel) by Tan Nguyen is model class that offers support for nested collections. It supports dot notation for getters and setters, and an updated toJSON that reflects the nested structure. Relationships can be defined between models as well.

var wallet = {  
  money: {
    amount: 4000,
    currency: 'euro'
  },
  name: 'Tan Nguyen'
};

var myStuff = new Backbone.Model();  
myStuff.set('wallet', wallet);  
myStuff.get('wallet').money.amount; // 4000  

The project includes tests and benchmarks, and examples can be found in the readme.