Commit 6dbc0a06 authored by JC Brand's avatar JC Brand

converse-dragresize: Remove the resize event listener

parent 3b29e575
......@@ -147,9 +147,13 @@ converse.plugins.add('converse-dragresize', {
const dragResizable = {
initDragResize () {
/* Determine and store the default box size.
* We need this information for the drag-resizing feature.
*/
const view = this;
const debouncedSetDimensions = _.debounce(() => view.setDimensions());
window.addEventListener('resize', view.debouncedSetDimensions)
this.model.on('destroy', () => window.removeEventListener('resize', debouncedSetDimensions));
// Determine and store the default box size.
// We need this information for the drag-resizing feature.
const flyout = this.el.querySelector('.box-flyout');
const style = window.getComputedStyle(flyout);
......@@ -358,12 +362,7 @@ converse.plugins.add('converse-dragresize', {
});
}
_converse.api.listen.on('registeredGlobalEventHandlers', registerGlobalEventHandlers);
_converse.api.listen.on('beforeShowingChatView', view => view.initDragResize().setDimensions());
_converse.api.listen.on('chatBoxInitialized', view => {
window.addEventListener('resize', _.debounce(() => view.setDimensions(), 100));
});
/************************ END Event Handlers ************************/
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment