mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Project Aphrodite
This commit is contained in:
28
frontend/src/Utilities/pagePopulator.js
Normal file
28
frontend/src/Utilities/pagePopulator.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user