propagate remove event for stored main view

This commit is contained in:
yuri
2019-10-22 12:25:40 +03:00
parent d49fff1289
commit f0f225f349
2 changed files with 20 additions and 2 deletions
+9 -1
View File
@@ -999,8 +999,16 @@ var Bull = Bull || {};
this.$el = $(el).eq(0);
this.el = this.$el[0];
}
},
propagateEvent: function () {
this.trigger.apply(this, arguments);
for (var key in this.nestedViews) {
var view = this.nestedViews[key];
view.propagateEvent.apply(view, arguments);
}
},
});
}).call(this, Bull, Backbone, _);
+11 -1
View File
@@ -157,7 +157,13 @@ define('controller', [], function () {
storeMainView: function (key, view) {
this.set('storedMainView-' + key, view);
view.once('remove', function () {
this.listenTo(view, 'remove', function (o) {
o = o || {};
if (o.ignoreCleaning) return;
this.stopListening(view, 'remove');
this.clearStoredMainView(key);
}, this);
},
@@ -278,6 +284,10 @@ define('controller', [], function () {
if (master.currentViewKey) {
this.set('storedScrollTop-' + master.currentViewKey, $(window).scrollTop());
if (this.hasStoredMainView(master.currentViewKey)) {
var mainView = master.getView('main');
if (mainView) {
mainView.propagateEvent('remove', {ignoreCleaning: true});
}
master.unchainView('main');
}
}