decord/source/utils/ContextUtils.tsx

35 lines
900 B
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 6667
2026-07-24 07:16:23 +00:00
// Function ID: 51371
2026-07-20 16:05:17 +00:00
// Name: createDefinedContext
2026-07-23 10:11:24 +00:00
// Dependencies: [31, 33, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-23 10:11:24 +00:00
// Module 6667 (createDefinedContext)
import result from "result";
import { jsx } from "jsxProd";
const result = require("set").fileFinishedImporting("utils/ContextUtils.tsx");
2026-07-20 16:05:17 +00:00
export default function createDefinedContext() {
2026-07-23 10:11:24 +00:00
function useContext(context, arg1) {
2026-07-20 16:05:17 +00:00
context = context.useContext(context);
if (null == context) {
const _Error = Error;
const error = new Error("Context was used outside of defined provider.");
throw error;
} else {
return context;
}
}
2026-07-23 10:11:24 +00:00
context = context.createContext(undefined);
2026-07-20 16:05:17 +00:00
const items = [
context,
useContext,
() => {
2026-07-23 10:11:24 +00:00
let result = useContext();
return (children) => useContext(redux.Provider, { value: redux, children: children.children });
2026-07-20 16:05:17 +00:00
}
];
return items;
};