Last active
December 21, 2015 21:09
-
-
Save mikedidthis/6366607 to your computer and use it in GitHub Desktop.
How should this be named to make it clear to another developer what is going on. ( Related: http://stackoverflow.com/questions/18481599/replicating-constructors-and-new-with-object-create)
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 app = app || {}; | |
// This is the 'model / sigular' | |
app.Bottle = { | |
someFunc : function () { | |
}, | |
someOtherFunc : function () { | |
} | |
}; | |
// This does something with all 'Bottle' hence Bottles. | |
app.Bottles = { | |
current : [], | |
create : function ( elems ) { | |
for (var i = 0, len = elems.length; i < len; i++) { | |
this.current.push( Object.create( app.Bottle, { 'elem' : { value: elems[ i ] } } ) ); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps you could place
app.Bottle
into a subgroup where it is understood that it is a model i.e.app.Model.Bottle
.