Sha256: 28c16df4adf99c4cdaf31ca6ca24f2f96b9d047230f3c7ef21bc16927606ba4c
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
var observer = require('./support/observer'); /** * Extension of {Backbone.View} which supports the concept of entering * and leaving a parent view -- a Composite in Booster. Leaving a composite * means disappearing from DOM and likely involves unbinding from any events * bound to the underlying model or collection. * * @extends {Backbone.View} * @constructor */ exports.View = Backbone.View.extend({ /** * Invoked when the view has entered a parent view (a composite). The default * behavior is to store a link to the composite for future reference. * * @param {Backbone.View} parent The composite view to which this view is added. */ enter: function(parent) { this.parent = parent; return this; }, /** * Invoked when the view is to leave the parent composite. The default behavior is * to remove the view from the DOM and unbind any event listeners, as well as any * bindings to {Backbone.Events} sources. * * This method should not normally be invoked directly. Instead, invoke `remove` on * the parent view which, in turn, will invoke `leave`. */ leave: function() { $(this.el).remove(); this.unobserve(); this.unbind(); return this; } }); _.extend(exports.View.prototype, observer.mixin());
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
booster-0.0.1 | lib/assets/javascripts/booster/view.js.boost |