I'd guess that something like this create
override would work:
create: function(attributes, options) {
options = options || { };
options.came_from_create = true;
return Backbone.Collection.prototype.create.call(this, attributes, options);
}
Then you could look for came_from_create
in your callback:
function onModelAdded(model, collection, options) {
if(options && options.came_from_create) {
// We started in a create call on the collection.
}
else {
// We came from somewhere else.
}
}
You can usually use the options
argument to piggy back bits of data around if you're careful not to use any option names that Backbone wants to use.