Skip to content

Instantly share code, notes, and snippets.

@mikedidthis
Last active December 21, 2015 21:09
Show Gist options
  • Save mikedidthis/6366607 to your computer and use it in GitHub Desktop.
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)
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 ] } } ) );
}
}
};
@eternalruler
Copy link

Perhaps you could place app.Bottle into a subgroup where it is understood that it is a model i.e. app.Model.Bottle.

@rlemon
Copy link

rlemon commented Aug 28, 2013

@mikedidthis then app.Bottles.Bottle is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment