Skip to content

Commit

Permalink
fix: Pass this context correctly to updateTeamList (#2277)
Browse files Browse the repository at this point in the history
  • Loading branch information
PartMan7 authored Sep 3, 2024
1 parent 04ed96b commit 2b095bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions play.pokemonshowdown.com/js/client-teambuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3246,21 +3246,21 @@
},
searchChange: function (e) {
var DEBOUNCE_THRESHOLD_TEAMS = 500;
var searchVal = e.currentTarget.value;
var self = this;
function updateTeamList() {
// 91 for right CMD / 93 for left CMD / 17 for CTL
if (e.keyCode !== 91 && e.keyCode !== 93 && e.keyCode !== 17) {
this.curSearchVal = searchVal;
self.curSearchVal = searchVal;
}
this.updateTeamList();
self.updateTeamList();
}

// If the user has a lot of teams, search is debounced to
// ensure this isn't called too frequently while typing
if (Storage.teams.length > DEBOUNCE_THRESHOLD_TEAMS) {
if (this.searchTimeout) clearTimeout(this.searchTimeout);

var searchVal = e.currentTarget.value;
this.searchTimeout = setTimeout(updateTeamList.bind(this), 400);
this.searchTimeout = setTimeout(updateTeamList, 400);
} else updateTeamList();

},
Expand Down

0 comments on commit 2b095bd

Please sign in to comment.