mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
14 lines
463 B
TypeScript
14 lines
463 B
TypeScript
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;
|
|
} |