I take a collection of several pages, and I am looking for a way to find out when all the extracts are completed. This is what my collection looks like:
app.collections.Repos = Backbone.Collection.extend({ model: app.models.Repo, initialize: function(last_page){ this.url = ('https://api.github.com/users/' + app.current_user + '/watched'); for (var i = 1; i <= last_page; i++) { this.fetch({add: true, data: {page: i}}); }; }, ...
Any idea how I could achieve this with clean code?
Gregory
source share