UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

62 lines (61 loc) 3 kB
/** * @internal */ export declare function _WarnImport(name: string, warnOnce?: boolean): string | undefined; /** * Enables or disables console warnings when generated side-effect stubs are called. * Warnings are disabled by default because internal code may probe optional augmented APIs. * @param enabled - Whether missing side-effect stub calls should emit one-time warnings. */ export declare function SetMissingSideEffectWarningsEnabled(enabled: boolean): void; /** * Runs a callback while missing side-effect stub warnings are suppressed. * @param callback - The callback to run with warnings suppressed. * @returns The callback result. */ export declare function SuppressMissingSideEffectWarnings<T>(callback: () => T): T; /** * Interface for functions that are side-effect stubs. * Used to type-safely check if a method is a stub without using `any`. * @internal */ export interface ISideEffectStub { /** Marker property indicating this is a side-effect stub */ __isSideEffectStub: true; } /** * Returns a stub function that acts as a placeholder for augmented methods that * require a side-effect import. The stub is tagged with `__isSideEffectStub` so * that feature-detection code can check `_IsSideEffectImplemented()` before calling. * * The stub does NOT warn by default because internal engine code frequently calls * augmented methods as feature checks (e.g., `getBoundingBoxRenderer?.()` in the * render loop). Warnings would fire every frame for features the user never requested. * * If the user actually tries to use the returned value (which is undefined), they * will get a clear TypeError at the point of use. * * @param className - The class name (for diagnostic purposes) * @param methodName - The method name (for diagnostic purposes) * @param warn - If true, emit a one-time console warning when the stub is called. * Use this only for methods that are never called internally as feature checks. * @internal */ export declare function _MissingSideEffect(className: string, methodName: string, warn?: boolean): (...args: unknown[]) => void; /** * Checks whether a value is a side-effect stub (i.e., a placeholder function * generated by _MissingSideEffect). Use this instead of truthiness checks when * doing feature detection on methods that may be stubbed for tree-shaking. * @param fn The function/method to check * @returns true if the function is a real implementation (not a stub or undefined/null) * @internal */ export declare function _IsSideEffectImplemented(fn: unknown): boolean; /** * Returns a property descriptor that acts as a placeholder for augmented properties * that require a side-effect import. The getter returns undefined (allowing pure code * to feature-detect by checking truthiness), and the setter replaces the stub with a * real data property on the instance. * @internal */ export declare function _MissingSideEffectProperty(className: string, propName: string): PropertyDescriptor;