mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
Merge pull request #5795 from kevinansfield/fix-console-error
Fix teardown of resize handler in content management screen
This commit is contained in:
commit
9d1d4ae5ba
@ -8,6 +8,8 @@ export default Ember.Component.extend({
|
||||
|
||||
resizeService: Ember.inject.service(),
|
||||
|
||||
_resizeListener: null,
|
||||
|
||||
calculatePreviewIsHidden: function () {
|
||||
if (this.$('.content-preview').length) {
|
||||
this.set('previewIsHidden', !this.$('.content-preview').is(':visible'));
|
||||
@ -16,8 +18,12 @@ export default Ember.Component.extend({
|
||||
|
||||
didInsertElement: function () {
|
||||
this._super(...arguments);
|
||||
this._resizeListener = Ember.run.bind(this, this.calculatePreviewIsHidden);
|
||||
this.get('resizeService').on('debouncedDidResize', this._resizeListener);
|
||||
this.calculatePreviewIsHidden();
|
||||
this.get('resizeService').on('debouncedDidResize',
|
||||
Ember.run.bind(this, this.calculatePreviewIsHidden));
|
||||
},
|
||||
|
||||
willDestroy: function () {
|
||||
this.get('resizeService').off('debouncedDidResize', this._resizeListener);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user