-
Notifications
You must be signed in to change notification settings - Fork 105
Closed
Labels
Description
We just found out that a call to reload() does not unbind the resize/scroll events, while the events are bound again when the data is loaded.
Steps to reproduce:
- Launch
Reload100demo app - Open your JS debugger and put a breakpoint on both
bindEvents()&unbindEvents() - Click the reload button from the demo page. The debugger breaks on
bindEventsbut not onunbindEvents
Possible solutions:
- add a call to unbindEvent() within reload
- keep a flag defining if the events are already bound like bellow:
let eventBound = false;
function bindEvents() {
if(!eventBound) {
eventBound = true;
viewport.bind('resize', resizeAndScrollHandler);
viewport.bind('scroll', resizeAndScrollHandler);
}
}
function unbindEvents() {
if(eventBound) {
eventBound = false;
viewport.unbind('resize', resizeAndScrollHandler);
viewport.unbind('scroll', resizeAndScrollHandler);
}
}
limingli0707