Skip to content

Commit

Permalink
refactor: assign component name vars by splicing descendants array
Browse files Browse the repository at this point in the history
  • Loading branch information
phloxic committed Oct 7, 2024
1 parent 234c4e3 commit c6b3e70
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/sprite-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ const spriteThumbs = (player, plugin, options) => {

// default control bar component tree is expected
// https://docs.videojs.com/tutorial-components.html#default-component-tree
const _controlBar = 'ControlBar';
const _progressControl = 'ProgressControl';
const _seekBar = 'SeekBar';
const _timeTooltip = 'TimeTooltip';
const playerDescendant = (componentName) => {
const descendants = [
_controlBar,
_progressControl,
_seekBar,
'MouseTimeDisplay',
_timeTooltip
];
const descendants = [
'ControlBar',
'ProgressControl',
'SeekBar',
'MouseTimeDisplay',
'TimeTooltip'
];
const [
_controlBar,
_progressControl,
_seekBar,
// MouseTimeDisplay unused
_timeTooltip
] = descendants.toSpliced(3, 1);

const playerDescendant = componentName => {
const idx = descendants.indexOf(componentName);
const component = player.getDescendant(descendants.slice(0, idx + 1));

Expand Down

0 comments on commit c6b3e70

Please sign in to comment.