Created
July 16, 2013 15:17
-
-
Save zbabtkis/6009675 to your computer and use it in GitHub Desktop.
Your extremely controlling mother in code.
This file contains hidden or 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
var Bani = (function() { | |
var types = { | |
'View': { | |
cool: 'hi', | |
age: new Date() | |
} | |
}; | |
function extend(name, type, obj) { | |
var extension = function() {}; | |
for(var key in types[type]) { | |
extension.prototype[key] = types[type][key]; | |
} | |
for(var key in obj) { | |
extension.prototype[key] = obj[key]; | |
} | |
types[name] = extension; | |
} | |
function get(name) { | |
var obj = new types[name](); | |
if(obj.initialize) obj.initialize.apply(obj); | |
return obj; | |
} | |
return { | |
get: get, | |
extend: extend | |
}; | |
}()); | |
Banni.extend('SubView', 'View', { | |
el: '#main-view', | |
initialize: function() { | |
this.$el = $(this.el); | |
console.log(this) | |
} | |
}); | |
var building = Bldr.get('SubView'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment