mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Abstract WebContainer into "JSRuntime" type
This commit is contained in:
1 parent
0986dd4e9d
commit
78398bcd7d
8 files changed
+316
-102
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user