Abstract WebContainer into "JSRuntime" type

This commit is contained in:
Alex Gleason committed 2025-07-20 16:21:49 -05:00
1 parent 0986dd4e9d
commit 78398bcd7d
8 files changed
+316 -102

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import { useContext } from 'react';
import { JSRuntimeContext, type JSRuntimeContextType } from '@/contexts/JSRuntimeContext';
/**
* Hook to access the JavaScript runtime
* @returns JSRuntime context with runtime instance
*/
export function useJSRuntime(): JSRuntimeContextType {
const context = useContext(JSRuntimeContext);
if (context === undefined) {
throw new Error('useJSRuntime must be used within a JSRuntimeProvider');
}
return context;
}