Lidarr/frontend/src/Store/Selectors/createCommandExecutingSelec...

16 lines
489 B
JavaScript
Raw Normal View History

2017-09-04 02:20:56 +00:00
import { createSelector } from 'reselect';
import { findCommand, isCommandExecuting } from 'Utilities/Command';
2017-09-04 02:20:56 +00:00
import createCommandsSelector from './createCommandsSelector';
function createCommandExecutingSelector(name, contraints = {}) {
2017-09-04 02:20:56 +00:00
return createSelector(
createCommandsSelector(),
(commands) => {
2018-09-02 03:11:19 +00:00
const command = findCommand(commands, { name, ...contraints });
return isCommandExecuting(command);
2017-09-04 02:20:56 +00:00
}
);
}
export default createCommandExecutingSelector;