Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

BaseClass

Matt Sweetman edited this page · 3 revisions

BaseClass

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.

Something went wrong with that request. Please try again.