Created
July 16, 2013 15:17
-
-
Save zbabtkis/6009675 to your computer and use it in GitHub Desktop.
Revisions
-
zbabtkis created this gist
Jul 16, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ 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');