decord/source/utils/ContextUtils.tsx

41 lines
1.1 KiB
TypeScript
Raw Normal View History

// Module ID: 7531
// Function ID: 7532
// Name: ContextUtils
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 21, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 7531 (ContextUtils)
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
const jsx = fn(21).jsx;
const size = fn(2);
const result = size.fileFinishedImporting("utils/ContextUtils.tsx");
2026-07-20 16:05:17 +00:00
export default function createDefinedContext() {
2026-07-23 10:11:24 +00:00
context = context.createContext(undefined);
2026-07-20 16:05:17 +00:00
const items = [
context,
function useContext() {
context = noop.useContext(context);
2026-07-29 08:29:29 +00:00
if (null == context) {
const _Error = Error;
const error = new Error("Context was used outside of defined provider.");
2026-07-29 08:29:29 +00:00
throw error;
} else {
return context;
}
},
2026-07-20 16:05:17 +00:00
() => {
2026-07-29 08:29:29 +00:00
context = context.useContext(context);
if (null == context) {
const _Error = Error;
const error = new Error("Context was used outside of defined provider.");
2026-07-29 08:29:29 +00:00
throw error;
} else {
return (children) => <context.Provider value={context}>{arg0.children}</context.Provider>;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
];
return items;
};