-
-
Save sgreenfield/5200582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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