/public/javascripts/bbclonemail.collection.js
JavaScript | 33 lines | 14 code | 4 blank | 15 comment | 0 complexity | 1ec60200dfa8312cf4a2e099b4dfea18 MD5 | raw file
- // Backbone.BBCloneMail
- // A reference application for Backbone.Marionette
- //
- // Copyright (C)2012 Derick Bailey, Muted Solutions, LLC
- // Distributed Under MIT License
- //
- // Documentation and Full License Available at:
- // http://github.com/derickbailey/backbone.bbclonemail
- // http://github.com/derickbailey/backbone.marionette
- //
- // BBCloneMail Models And Collections
- // ----------------------------------
- // Provide a guaranteed execution of a "reset" event for
- // collections so I can find an item in the collection after
- // the collection has been loaded.
- BBCloneMail.Collection = Backbone.Collection.extend({
- constructor: function(){
- var args = Array.prototype.slice.call(arguments);
- Backbone.Collection.prototype.constructor.apply(this, args);
- this.onResetCallbacks = new Backbone.Marionette.Callbacks();
- this.on("reset", this.runOnResetCallbacks, this);
- },
- onReset: function(callback){
- this.onResetCallbacks.add(callback);
- },
- runOnResetCallbacks: function(){
- this.onResetCallbacks.run(this, this);
- }
- });