mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-31 21:22:20 -05:00
Clear global events every once in a while
This should presumably fix a memory leak from jslider binding global events and not bothering unbinding them or even making them easy to unbind.
This commit is contained in:
parent
e3aa7cc3c4
commit
e3a9ab68af
|
|
@ -58,6 +58,7 @@
|
|||
if (this.exportMode) {
|
||||
this.exportMode = false;
|
||||
} else if (this.curSet) {
|
||||
app.clearGlobalListeners();
|
||||
this.curSet = null;
|
||||
} else if (this.curTeam) {
|
||||
this.curTeam = null;
|
||||
|
|
@ -579,6 +580,7 @@
|
|||
curChartName: '',
|
||||
updateChart: function() {
|
||||
var type = this.curChartType;
|
||||
app.clearGlobalListeners();
|
||||
if (type === 'stats') {
|
||||
this.updateStatForm();
|
||||
return;
|
||||
|
|
@ -775,6 +777,7 @@
|
|||
this.$chart.html(buf);
|
||||
var self = this;
|
||||
this.suppressSliderCallback = true;
|
||||
app.clearGlobalListeners();
|
||||
this.$chart.find('.evslider').slider({
|
||||
from: 0,
|
||||
to: 252,
|
||||
|
|
@ -1898,6 +1901,10 @@
|
|||
} while (template && template.species && !alreadyChecked[template.speciesid]);
|
||||
Tools.movelists[pokemon] = moves;
|
||||
}
|
||||
},
|
||||
destroy: function() {
|
||||
app.clearGlobalListeners();
|
||||
Room.prototype.destroy.call(this);
|
||||
}
|
||||
}, {
|
||||
// static
|
||||
|
|
|
|||
|
|
@ -862,6 +862,11 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
clearGlobalListeners: function() {
|
||||
// jslider doesn't clear these when it should,
|
||||
// so we have to do it for them :/
|
||||
$(document).off('click touchstart mousedown touchmove mousemove touchend mouseup');
|
||||
},
|
||||
|
||||
/*********************************************************
|
||||
* Rooms
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user