Skip to content

Instantly share code, notes, and snippets.

Created March 19, 2013 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5200577 to your computer and use it in GitHub Desktop.
Save anonymous/5200577 to your computer and use it in GitHub Desktop.
//micro backbone-ish experiment with prototypal inheritance
var Vertebra = {}; //not backbone.js, not spine.js, Vertebra!
Vertebra.instance = function(){
this.initialize(arguments);
};
Vertebra.create = (function() {
function F(args){ return Vertebra.instance.apply(this, args); }
F.prototype = Vertebra.instance.prototype;
F.prototype.initialize = function(args){
console.log('initialize', this, ' with args: ', args);
return this;
};
return function(){
return new F(arguments);
};
})();
var vertebra = Vertebra.create({ name: 'test', options: { someOption: true } });
console.log(vertebra);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment