Skip to content

Commit

Permalink
Replace usage of findIndex
Browse files Browse the repository at this point in the history
Not supported on older TVs, and code path may be executed before the player installs the polyfill
  • Loading branch information
felix-hoc committed Jan 8, 2025
1 parent 82c7153 commit c5aaeb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ts/components/listselector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ export abstract class ListSelector<Config extends ListSelectorConfig> extends Co
}

private getItemIndex(key: string): number {
return this.items.findIndex((item) => item.key === key);
for (let i = 0; i < this.items.length; i++) {
if (this.items[i].key === key) {
return i;
}
}

return -1;
}

/**
Expand Down

0 comments on commit c5aaeb3

Please sign in to comment.