splatoon3.ink/app/data/index.mjs
2022-11-15 13:44:39 -05:00

39 lines
1.2 KiB
JavaScript

import GearUpdater from "./updaters/GearUpdater.mjs";
import StageScheduleUpdater from "./updaters/StageScheduleUpdater.mjs";
import CoopUpdater from "./updaters/CoopUpdater.mjs";
import FestivalUpdater from "./updaters/FestivalUpdater.mjs";
import CurrentFestivalUpdater from "./updaters/CurrentFestivalUpdater.mjs";
import { regionTokens } from "../splatnet/NsoClient.mjs";
function updaters() {
const tokens = regionTokens();
return [
new StageScheduleUpdater,
new GearUpdater,
new CoopUpdater,
tokens.US && new FestivalUpdater('US'),
tokens.EU && new FestivalUpdater('EU'),
tokens.JP && new FestivalUpdater('JP'),
tokens.AP && new FestivalUpdater('AP'),
tokens.US && new CurrentFestivalUpdater('US'),
tokens.EU && new CurrentFestivalUpdater('EU'),
tokens.JP && new CurrentFestivalUpdater('JP'),
tokens.AP && new CurrentFestivalUpdater('AP'),
].filter(u => u);
}
export async function updateAll() {
console.info('Running all updaters...');
for (let updater of updaters()) {
try {
await updater.updateIfNeeded();
} catch (e) {
console.error(e);
}
}
console.info('Done running updaters');
}