Matt Sweetman edited this page Apr 30, 2013 · 3 revisions


BaseClass is a simple object that provides Backbone-style definitions for your own classes.

The core Backbone objects (Model, View, Collection and Router) have a convention for construction and initialization that makes them feel more like traditional classes. BaseClass provides you with the same structure for use in non-Backbone classes.

var BaseClass = require('wand/lib/BaseClass');

var Animal = BaseClass.extend({
  initialize: function(options) {
    this.species = options.species;

var dog = new Animal({species: 'dog'});

initialize is an optional function, but if specified will receive the first argument from the constructor.

Note: Internally BaseClass uses Utils.createClass to create a class constructor.