Backbone + RequireJS: Making Collection Persisting?
问题 I'm using Backbone with RequireJS, and my View needs to switch between like, say, 20 collections corresponding to respective RESTful APIs. The "normal" way handles things fine, except that for each API a new Collection needs to be defined, resulting in a hugely bloated codebase: Collection (x 20 times) define(function(require) { var Backbone = require('backbone'); var c = Backbone.Collection.extend({ url: '/path/to/api-1' }); return new c(); }); View define(function(require) { var Backbone =