Standard way of returning backbone collection in requirejs

hostgatorboy

New Member
I've seen different examples in different articles about how to return a Backbone collection (or View, for that matter) from a RequireJS define. For example:\[code\]define(['models/person'], function( person ) { var personCollection = Backbone.Collection.extend({ model: person, url: "api/person" }); // do this? return new personCollection(); // or this? //return personCollection();});\[/code\]Is there a memory advantage to either approach? Is there standard design pattern that dictates which should be used?The same question would apply to views, as I've seen them done both ways too.
 
Back
Top