From 234c4e3f0c991e1a126fc189068dd903560b94d5 Mon Sep 17 00:00:00 2001 From: Christian Ebert Date: Tue, 1 Oct 2024 15:12:42 +0100 Subject: [PATCH] style: always call event handlers by name --- src/sprite-thumbnails.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sprite-thumbnails.js b/src/sprite-thumbnails.js index 825725d..19b732d 100644 --- a/src/sprite-thumbnails.js +++ b/src/sprite-thumbnails.js @@ -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); @@ -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: @@ -206,6 +206,7 @@ const spriteThumbs = (player, plugin, options) => { }); }; + plugin.on('statechanged', handleStateChanged); player.on(['loadstart', 'loadedmetadata'], init); player.addClass('vjs-sprite-thumbnails'); };