Skip to content

Commit

Permalink
refactor: remove 'diagnostic' property of plugin state
Browse files Browse the repository at this point in the history
This is now better handled in the various checks on loadstart.
  • Loading branch information
phloxic committed Dec 23, 2023
1 parent f4a43ea commit 1988633
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SpriteThumbnails extends Plugin {
}

// Define default values for the plugin's `state` object here.
SpriteThumbnails.defaultState = {ready: false, diagnostics: false};
SpriteThumbnails.defaultState = {ready: false};

// Include the version number.
SpriteThumbnails.VERSION = VERSION;
Expand Down
14 changes: 4 additions & 10 deletions src/sprite-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const spriteThumbs = (player, plugin, options) => {
const merge = obj.merge;
const log = plugin.log;

const defaultState = merge({}, plugin.state);

const controls = player.controlBar;

// default control bar component tree is expected
Expand Down Expand Up @@ -121,12 +119,10 @@ const spriteThumbs = (player, plugin, options) => {
debug('ready to show thumbnails');
progress.on(spriteEvents, hijackMouseTooltip);
} else {
if (pstate.diagnostics) {
if (!options.url && !options.urlArray.length) {
log('no urls given');
}
debug('resetting');
if (!options.url && !options.urlArray.length) {
log('no urls given');
}
debug('resetting');
progress.off(spriteEvents, hijackMouseTooltip);
tooltipEl.style = tooltipStyleOrig;
}
Expand All @@ -153,15 +149,13 @@ const spriteThumbs = (player, plugin, options) => {
} else if (srcOpts.url) {
srcOpts.urlArray = [];
}
plugin.setState(defaultState);
plugin.options = options = merge(options, srcOpts);
}

plugin.setState({
ready: !!(mouseTimeTooltip && (options.urlArray.length || options.url) &&
intCheck('width') && intCheck('height') && intCheck('columns') &&
intCheck('rows') && downlinkCheck()),
diagnostics: true
intCheck('rows') && downlinkCheck())
});
});

Expand Down

0 comments on commit 1988633

Please sign in to comment.