From c6b3e70cd37f74f47622654eab9f27edec3cc646 Mon Sep 17 00:00:00 2001 From: Christian Ebert Date: Mon, 7 Oct 2024 02:20:21 +0100 Subject: [PATCH] refactor: assign component name vars by splicing descendants array --- src/sprite-thumbnails.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/sprite-thumbnails.js b/src/sprite-thumbnails.js index 19b732d..079b6bc 100644 --- a/src/sprite-thumbnails.js +++ b/src/sprite-thumbnails.js @@ -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));