Removing remaining artistLoaded, albumLoaded, etc in favor of itemLoaded for consistent pipeline; Looking at search
This commit is contained in:
@ -369,20 +369,26 @@ let isObject = function (value) {
|
||||
* @param key = string (the string to lookup)
|
||||
* @return boolean
|
||||
* */
|
||||
const isLoading = function (load_queue = [], keys = []) {
|
||||
// Loop all of our load queue items
|
||||
for (const load_queue_key in load_queue) {
|
||||
// Make sure it's not a root object method
|
||||
if (load_queue.hasOwnProperty(load_queue_key)) {
|
||||
// Loop all the keys we're looking for
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
if (load_queue[load_queue_key].includes(keys[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const isLoading = function (load_queue = {}, keys = []) {
|
||||
if (!load_queue || !keys) return false;
|
||||
|
||||
const queue_keys = Object.keys(load_queue);
|
||||
const matches = keys.reduce((acc, key) => {
|
||||
let regex = '';
|
||||
try {
|
||||
regex = new RegExp(key);
|
||||
} catch {
|
||||
console.error('Invalid regular expression', keys);
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return [
|
||||
...acc,
|
||||
...(queue_keys.filter((qk) => qk.match(regex))),
|
||||
];
|
||||
}, []);
|
||||
|
||||
return matches.length > 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user