!function (Backbone) { // Store blank stuff here var blankEl = $() , blankModel = new Backbone.Model.extend() , blankCollection = new Backbone.Collection.extend({ model: blankModel }) , blankView = new Backbone.View.extend({ el: blankEl }) // Construct behaviour manager Backbone.Behaviour = function (options) { // Store options if (this.options) { options = _.extend({}, this.options, options) } this.options = options // Attach model this.model = options.model || blankModel this.collection = options.collection || blankCollection // Prepare view var view = options.view || blankView view.model = this.model view.render && view.render() // Attach view this.view = view // Finally, initialize this.initialize.apply(this, arguments) } // Just copy an existing extender Backbone.Behaviour.extend = Backbone.Model.extend }(window.Backbone || {})