decord/beta/source/utils/ContextUtils.tsx

47 lines
1.2 KiB
TypeScript
Raw Normal View History

// Module ID: 6848
// Function ID: 6849
// Name: ContextUtils
// Dependencies: [19, 21, 2]
// Exports: default
// Module 6848 (ContextUtils)
2026-10-01 14:13:23 +00:00
import Fragment from "Fragment" /* 21 */;
import react from "react" /* 19 */;
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
const jsx = Fragment.jsx;
const result = size.fileFinishedImporting("utils/ContextUtils.tsx");
export default function createDefinedContext() {
2026-10-01 14:13:23 +00:00
let context;
context = context.createContext(undefined);
const items = [
context,
function useContext() {
2026-10-01 14:13:23 +00:00
context = react.useContext(context);
if (null == context) {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Context was used outside of defined provider.");
throw error;
} else {
return context;
}
},
2026-10-01 14:13:23 +00:00
function() {
context = context.useContext(context);
if (null == context) {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Context was used outside of defined provider.");
throw error;
} else {
return (children) => <context.Provider value={context}>{arg0.children}</context.Provider>;
}
}
];
return items;
};