Skip to content

Commit

Permalink
style: always call event handlers by name
Browse files Browse the repository at this point in the history
  • Loading branch information
phloxic committed Oct 1, 2024
1 parent 206da48 commit 234c4e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sprite-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const spriteThumbs = (player, plugin, options) => {
return check;
};

plugin.on('statechanged', () => {
const handleStateChanged = evt => {
const pstate = plugin.state;
const spriteEvents = ['mousemove', 'touchmove'];
const progress = playerDescendant(_progressControl);
Expand All @@ -154,7 +154,7 @@ const spriteThumbs = (player, plugin, options) => {
}
}
player.toggleClass('vjs-thumbnails-ready', pstate.ready);
});
};

const init = evt => {
// `loadstart` callback is only needed when all of the following apply:
Expand Down Expand Up @@ -206,6 +206,7 @@ const spriteThumbs = (player, plugin, options) => {
});
};

plugin.on('statechanged', handleStateChanged);
player.on(['loadstart', 'loadedmetadata'], init);
player.addClass('vjs-sprite-thumbnails');
};
Expand Down

0 comments on commit 234c4e3

Please sign in to comment.