decord/alpha/source/modules/games/hooks/useGame.tsx

159 lines
4.1 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 7002
// Function ID: 7003
// Name: useGame
2026-10-09 10:00:15 +00:00
// Dependencies: [5, 19, 2020, 1085, 504, 1102, 7003, 558, 576, 2]
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 7002 (useGame)
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import DurationsDefault from "Durations" /* 1102 */;
2026-10-09 10:00:15 +00:00
import GameActionCreators from "GameActionCreators" /* 7003 */;
2026-10-03 08:58:59 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
import react from "react" /* 19 */;
2026-10-09 10:00:15 +00:00
import GameStore from "GameStore" /* 2020 */;
2026-10-03 08:58:59 +00:00
import get_initialized from "get initialized" /* 504 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const require = globalThis.__r;
let _require, c1, c2;
const QueryIds = Constants.QueryIds;
let obj = {
getQueryId: QueryIds.GAME,
failureStaleAfter: 15 * DurationsDefault.Seconds.SECOND,
get(gameId) {
2026-10-03 08:58:59 +00:00
let tmp = null;
if (null != gameId) {
let NO_DATA;
const obj = GameStore;
if (GameStore.hasNoData(gameId)) {
2026-10-03 08:58:59 +00:00
NO_DATA = require("get initialized").NO_DATA;
2026-07-29 08:29:29 +00:00
} else {
NO_DATA = obj.getGame(gameId);
2026-07-29 08:29:29 +00:00
if (NO_DATA == null) {
NO_DATA = null;
}
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp = NO_DATA;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
},
2026-10-08 09:57:35 +00:00
load() {
2026-10-03 08:58:59 +00:00
return closure_2(...arguments);
2026-07-29 08:29:29 +00:00
},
2026-10-03 08:58:59 +00:00
getIsLoading(arg0) {
const isFetchingResult = null != arg0 && GameStore.isFetching(arg0);
return isFetchingResult;
},
getError(item) {
let error = null;
if (null != item) {
error = null;
if (GameStore.didFetchingFail(item)) {
const _Error = Error;
const self = this;
const self2 = this;
error = new Error("Failed to fetch game data");
}
}
return error;
}
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
const createFetchStore = get_initialized.createFetchStore;
let closure_2 = _asyncToGenerator(async (arg0, value) => {
let obj2;
let closure_0 = arg0;
if (c1 === 2) {
c1 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-03 08:58:59 +00:00
} else if (tmp2 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c1 = 2;
if (0 === c2) {
if (arg0 === 1) {
c1 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c1 = 3;
const obj4 = { value, done: true };
return obj4;
} else if (null != closure_0) {
2026-10-03 08:58:59 +00:00
const items = [tmp4];
c2 = 1;
c1 = 1;
2026-10-03 08:58:59 +00:00
const obj5 = { value: obj2.fetchGamesWithSupplementalData(items), done: false };
obj2 = GameActionCreators;
return obj5;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c1 = 3;
throw value;
} else if (arg0 === 2) {
c1 = 3;
const obj = { value, done: true };
return obj;
2026-07-29 08:29:29 +00:00
}
c1 = 3;
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-10-03 08:58:59 +00:00
} catch (tmp8) {
c1 = 3;
throw tmp8;
2026-07-29 08:29:29 +00:00
}
}
2026-07-20 16:05:17 +00:00
});
2026-10-03 08:58:59 +00:00
const fetchStore = createFetchStore(GameStore, obj);
2026-10-08 09:57:35 +00:00
const tmp6 = ReactCompilerGating.isReactCompilerEnabled() ? (function useGames(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
let tmp2;
let tmp3;
_require = arg0;
const obj = require("react");
const cResult = obj.c(3);
if (cResult[0] !== arg0) {
2026-10-08 09:57:35 +00:00
const fn = function l() {
2026-10-03 08:58:59 +00:00
let items = [
...closure_0.map((item) => {
const items = [item];
return items;
})
];
fetchStore.fetchMany.apply(items);
};
let items = [arg0];
cResult[0] = arg0;
cResult[1] = fn;
cResult[2] = items;
tmp3 = items;
tmp2 = fn;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
tmp2 = cResult[1];
tmp3 = cResult[2];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const effect = react.useEffect(tmp2, tmp3);
2026-10-08 09:57:35 +00:00
}) : (function useGames(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0 = arg0;
let items = [arg0];
const effect = react.useEffect(() => {
2026-07-23 10:11:24 +00:00
let items = [
...closure_0.map((item) => {
const items = [item];
2026-07-20 16:05:17 +00:00
return items;
})
];
fetchStore.fetchMany.apply(items);
2026-07-20 16:05:17 +00:00
}, items);
2026-10-03 08:58:59 +00:00
});
const result = size.fileFinishedImporting("modules/games/hooks/useGame.tsx");
export const useGame = fetchStore;
export const useGames = tmp6;