react-babylonjs
Version:
React for Babylon.js
23 lines (22 loc) • 997 B
TypeScript
import { Engine } from '@babylonjs/core/Engines/engine.js';
import { WebGPUEngine } from '@babylonjs/core/Engines/webgpuEngine.js';
import { Nullable } from '@babylonjs/core/types.js';
import React from 'react';
export type EngineCanvasContextType = {
engine: Nullable<Engine | WebGPUEngine>;
canvas: Nullable<HTMLCanvasElement | WebGLRenderingContext>;
};
export declare const EngineCanvasContext: React.Context<EngineCanvasContextType>;
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export declare function withEngineCanvasContext<P extends {
engineCanvasContext: EngineCanvasContextType;
}, R = Omit<P, 'engineCanvasContext'>>(Component: React.ComponentClass<P> | React.FC<P>): React.FC<R>;
/**
* Get the engine from the context.
*/
export declare const useEngine: () => Nullable<Engine | WebGPUEngine>;
/**
* Get the canvas DOM element from the context.
*/
export declare const useCanvas: () => Nullable<HTMLCanvasElement | WebGLRenderingContext>;
export {};