Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A convenient super method for the popular JavaScript library, Backbone.js.

branch: master

Merge pull request #22 from jvitela/master

Minified latest changes to include AMD Module definition
latest commit a0e3bc73b3
Lukas Olson authored
Octocat-spinner-32 backbone-super Minified latest changes to include AMD Module definition April 16, 2014
Octocat-spinner-32 LICENSE Add license file November 12, 2012
Octocat-spinner-32 README.md fix bad utf8 character in readme February 05, 2014
Octocat-spinner-32 bower.json Update version January 23, 2014
Octocat-spinner-32 package.json Update version January 23, 2014
README.md

Backbone-Super

This Backbone.js plugin provides a convenient super method.

Usually, when you're using Backbone.js, you have to do some funky (well, not funky... Javascript-y) stuff to be able to access parent methods.

From the Backbone.js documentation:

Brief aside on super: JavaScript does not provide a simple way to call super — the function of the same name defined higher on the prototype chain. If you override a core function like set, or save, and you want to invoke the parent object's implementation, you'll have to explicitly call it, along these lines:

var Note = Backbone.Model.extend({
    set: function(attributes, options) {
        Backbone.Model.prototype.set.call(this, attributes, options);
        ...
    }
});

After including this plugin, you can do the same thing with the following syntax:

var Note = Backbone.Model.extend({
    set: function(attributes, options) {
        this._super(attributes, options);
        ...
    }
});

To use it, simply include it after you include Backbone.js:

<script type="text/javascript" src="backbone.js"></script>
<script type="text/javascript" src="backbone-super.js"></script>
Something went wrong with that request. Please try again.