You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/frontend/src/Utilities/pagePopulator.js

29 lines
549 B

let currentPopulator = null;
let currentReasons = [];
export function registerPagePopulator(populator, reasons = []) {
currentPopulator = populator;
currentReasons = reasons;
}
export function unregisterPagePopulator(populator) {
if (currentPopulator === populator) {
currentPopulator = null;
currentReasons = [];
}
}
export function repopulatePage(reason) {
if (!currentPopulator) {
return;
}
if (!reason) {
currentPopulator();
}
if (reason && currentReasons.includes(reason)) {
currentPopulator();
}
}