82 lines
1.9 KiB
TypeScript
82 lines
1.9 KiB
TypeScript
// Metro module 5907 (f5908).
|
|
import GameStore from "./GameStore";
|
|
import { Endpoints } from "../../Constants";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { BatchInvocationManager } from "../../_bundle/Timeout";
|
|
import Module12 from "../../_bundle/Module12";
|
|
let c3699_8;
|
|
let c3700_0;
|
|
let env3699 = {};
|
|
const requestGames = async function requestGames(game_ids) {
|
|
let c25642_3 = 0;
|
|
let c29634_0, c29634_1;
|
|
L10: {
|
|
try {
|
|
c29634_0 = game_ids;
|
|
c29634_1 = void 0;
|
|
c25642_3 = 1;
|
|
c29634_1 = (await HTTP.get({
|
|
url: Endpoints.GAMES,
|
|
query: {
|
|
game_ids
|
|
},
|
|
rejectWithError: true
|
|
})).body;
|
|
Dispatcher.dispatch({
|
|
type: "GAME_FETCH_SUCCESS",
|
|
gameIds: c29634_0,
|
|
games: c29634_1
|
|
});
|
|
c25642_3 = 0;
|
|
} catch ($e) {
|
|
let r23 = $e;
|
|
if (c25642_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c25642_3 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "GAME_FETCH_FAILURE",
|
|
gameIds: c29634_0
|
|
});
|
|
break L10;
|
|
} catch ($e) {
|
|
r23 = $e;
|
|
if (c25642_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r23;
|
|
}
|
|
}
|
|
};
|
|
c3700_0 = void 0;
|
|
c3700_0 = async (c25644_0) => {
|
|
await Promise.all(Module12.chunk(c25644_0, 20).map(requestGames));
|
|
};
|
|
c3699_8 = new BatchInvocationManager(function() {
|
|
const apply = c3700_0.apply;
|
|
return c3700_0.apply(this, arguments);
|
|
}, {
|
|
predicate: (a0) => !GameStore.hasNoData(a0),
|
|
onQueued: (a0) => Dispatcher.dispatch({
|
|
type: "GAME_FETCH",
|
|
gameIds: a0
|
|
}),
|
|
onCancelled: (a0) => Dispatcher.dispatch({
|
|
type: "GAME_FETCH_CANCELLED",
|
|
gameIds: a0
|
|
})
|
|
});
|
|
export async function fetchGamesWithSupplementalData(c25643_0) {
|
|
L11: {
|
|
if (c25643_0.length !== 0) {
|
|
await c3699_8.queue(c25643_0);
|
|
break L11;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|