Skip to content

Instantly share code, notes, and snippets.

@sgreenfield
Forked from anonymous/vertebra.js
Created March 19, 2013 22:07
Show Gist options
  • Save sgreenfield/5200582 to your computer and use it in GitHub Desktop.
Save sgreenfield/5200582 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