UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

41 lines (40 loc) 1.31 kB
declare type Type = new (...args: any[]) => any; declare class _TypeStore { private _types; private _reverseTypes; private _lazyLoaders; constructor(); /** * add a type to the store */ add(key: string, type: Type): void; /** * Register a lazy-loadable type. The loader is called on first use via {@link getAsync}. * Once resolved, the type is cached for synchronous access via {@link get}. */ addLazy(key: string, loader: () => Promise<Type>): void; /** * @returns the type for the given key if registered */ get(key: string): Type | null; /** * Async version of {@link get} that also resolves lazy-registered types. * After resolving, the type is cached for future synchronous access. */ getAsync(key: string): Promise<Type | null>; /** * @returns the key/name for the given type if registered */ getKey(type: Type): string | null; } export declare const $BuiltInTypeFlag: unique symbol; export declare const TypeStore: _TypeStore; /** * add to a class declaration to automatically register it to the TypeStore (required for HMR right now) * * `@registerType` * * `export class MyType extends Behaviour { ... }` */ export declare const registerType: (constructor: Type) => void; export {};