Skip to content

Commit 6b6c396

Browse files
committed
correctly remove window resize event
fix #1369, we now remove resize event correctly in destroy()
1 parent 3e5071d commit 6b6c396

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Change log
4141

4242
- fix `minWidth()`, `minHeight()`, `maxHeight()` to set node value as well [1359](https://github.com/gridstack/gridstack.js/issues/1359)
4343
- fix `GridStackOptions` spelling [1359](https://github.com/gridstack/gridstack.js/issues/1359)
44+
- fix remove window resize event when `grid.destroy()` [1369](https://github.com/gridstack/gridstack.js/issues/1369)
4445

4546
## 2.0.0 (2020-09-07)
4647

src/gridstack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ export class GridStack {
302302

303303
this._updateContainerHeight();
304304

305-
window.addEventListener('resize', this._onResizeHandler.bind(this));
305+
this._onResizeHandler = this._onResizeHandler.bind(this); // so we can properly remove later
306+
window.addEventListener('resize', this._onResizeHandler);
306307
this._onResizeHandler();
307308

308309
this._setupDragIn();

0 commit comments

Comments
 (0)